<!DOCTYPE html><html lang="zh-CN,en,default"><head hexo-theme="https://github.com/volantis-x/hexo-theme-volantis/tree/4.3.1"><meta charset="utf-8"><meta http-equiv="x-dns-prefetch-control" content="on"><link rel="dns-prefetch" href="https://cdn.jsdelivr.net"><link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin><meta name="renderer" content="webkit"><meta name="force-rendering" content="webkit"><meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"><meta name="HandheldFriendly" content="True"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"><link rel="preload" href="/css/first.css" as="style"><title>Hexo搭建个人博客 - Tang&#39;s blog.</title><meta name="keywords" content="Hexo,Nodejs"><meta name="description" content="本人的博客最终选择了Hexo，原因：

强大的社区，基本什么问题都能查到，网上各种主题模板资料很全，各种QQ群一起high，讨论。
插件功能强大，技术成熟，使用起来很方便，从而封装性很好。
也能使用自动化部署技术GitHubActions或者TravisCi技术,弥补了相对于Jekyll博客能在Github自动部..."><link rel="alternate" href="/atom.xml" title="Tang's blog." type="application/atom+xml"><meta name="msapplication-TileColor" content="#ffffff"><meta name="msapplication-config" content="https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/blog/favicon/browserconfig.xml"><meta name="theme-color" content="#ffffff"><link rel="apple-touch-icon" sizes="180x180" href="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/img/favicon/cf_1o_180x180.png"><link rel="icon" type="image/png" sizes="32x32" href="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/img/favicon/cf_1o_32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/img/favicon/cf_1o_16x16.png"><link rel="manifest" href="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/img/favicon/manifest2.json"><link rel="mask-icon" href="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/img/favicon/cf_image2vector.svg" color="#5bbad5"><link rel="shortcut icon" href="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/img/favicon/32favicon32.ico"><link rel="stylesheet" href="/css/first.css"><link rel="stylesheet" href="/css/style.css" media="print" onload='this.media="all",this.onload=null'><noscript><link rel="stylesheet" href="/css/style.css"></noscript><script id="loadcss"></script><script>window.MSInputMethodContext&&document.documentMode&&document.write('<style>html{overflow-x: hidden !important;overflow-y: hidden !important;}.kill-ie{text-align:center;height: 100%;margin-top: 15%;margin-bottom: 5500%;}</style><div class="kill-ie"><h1><b>抱歉，您的浏览器无法访问本站</b></h1><h3>微软已经于2016年终止了对 Internet Explorer (IE) 10 及更早版本的支持，<br/>继续使用存在极大的安全隐患，请使用当代主流的浏览器进行访问。</h3><br/><a target="_blank" rel="noopener external nofollow noreferrer" href="https://www.microsoft.com/zh-cn/WindowsForBusiness/End-of-IE-support"><strong>了解详情 ></strong></a></div>')</script><noscript><style>html{overflow-x:hidden!important;overflow-y:hidden!important}.kill-noscript{text-align:center;height:100%;margin-top:15%;margin-bottom:5500%}</style><div class="kill-noscript"><h1><b>抱歉，您的浏览器无法访问本站</b></h1><h3>本页面需要浏览器支持（启用）JavaScript</h3><br> <a target="_blank" rel="noopener external nofollow noreferrer" href="https://www.baidu.com/s?wd=启用JavaScript"><strong>了解详情 ></strong></a></div></noscript></head><body><header id="l_header" class="l_header always shadow blur show"><div class="container"><div id="wrapper"><div class="nav-sub"><p class="title"></p><ul class="switcher nav-list-h m-phone" id="pjax-header-nav-list"><li><a id="s-comment" class="fas fa-comments fa-fw" target="_self" href="javascript:void(0)" rel="external nofollow noreferrer"></a></li><li><a id="s-toc" class="s-toc fas fa-list fa-fw" target="_self" href="javascript:void(0)" rel="external nofollow noreferrer"></a></li></ul></div><div class="nav-main"> <a class="title flat-box" target="_self" href="/"><img no-lazy class="logo" src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/img/cover/fav/cf_o1x64.jpg"></a><div class="menu navigation"><ul class="nav-list-h m-pc"><li><a class="menuitem flat-box faa-parent animated-hover" href="/" id="home"><i class="fas fa-home fa-fw"></i> Home</a></li><li><a class="menuitem flat-box faa-parent animated-hover"><i class="fas fa-th-list fa-fw"></i> Articles</a><ul class="list-v"><li><a class="menuitem flat-box faa-parent animated-hover" href="/categories/" id="categories"><i class="fas fa-folder-open fa-fw"></i> Categories</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/tags/" id="tags"><i class="fas fa-tags fa-fw"></i> Tags</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/archives/" id="archives"><i class="fas fa-archive fa-fw"></i> Archives</a></li></ul></li><li><a class="menuitem flat-box faa-parent animated-hover"><i class="fas fa-fan faa-spin animated fa-fw"></i> Play</a><ul class="list-v"><li><a class="menuitem flat-box faa-parent animated-hover" href="/catchTheCat/" id="catchTheCat"><i class="fas fa-cat faa-wrench animated-hover fa-fw"></i> Chat Noir</a></li></ul></li><li><a class="menuitem flat-box faa-parent animated-hover"><i class="fas fa-cog fa-spin fa-fw"></i> Tools</a><ul class="list-v"><li><a class="menuitem flat-box header toggle-mode-btn"><i class="fas fa-moon fa-fw"></i> 暗黑模式</a></li><li></li><li><a class="menuitem flat-box"><i class="fas fa-compact-disc fa-fw music"></i> Music</a><ul class="list-v"><li><div class="aplayer-container"><meting-js theme="#1BCDFC" autoplay="false" volume="0.7" loop="all" order="list" fixed="false" list-max-height="320px" server="netease" type="playlist" id="5472211102" list-folded="true"></meting-js></div></li></ul></li><li></li></ul></li><li><a class="menuitem flat-box faa-parent animated-hover"><i class="fas fa-info-circle fa-fw"></i> Me</a><ul class="list-v"><li><a class="menuitem flat-box faa-parent animated-hover" href="/about/" id="about"><i class="fas fa-ellipsis-v fa-fw"></i> About</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="https://aner1001.gitee.io/resume/" target="_blank" id="https:aner1001giteeioresume"><i class="fas fa-clock fa-fw"></i> Resume</a></li></ul></li></ul></div><div id="tp-weather-widget"></div><script>!function(e,t,n,a,i,o,c,r){r=function(){o=t.createElement(n),c=t.getElementsByTagName(n)[0],o.src=i,o.charset="utf-8",o.async=1,c.parentNode.insertBefore(o,c)},e.SeniverseWeatherWidgetObject=a,e[a]||(e[a]=function(){(e[a].q=e[a].q||[]).push(arguments)}),e[a].l=+new Date,e.attachEvent?e.attachEvent("onload",r):e.addEventListener("load",r,!1)}(window,document,"script","SeniverseWeatherWidget","//cdn.sencdn.com/widget2/static/js/bundle.js?t="+parseInt(((new Date).getTime()/1e8).toString(),10)),window.SeniverseWeatherWidget("show",{flavor:"slim",location:"WTW3SJ5ZBJUY",geolocation:!0,language:"zh-Hans",unit:"c",theme:"auto",token:"563a4097-8461-469b-ac30-123bac0010d1",hover:"enabled",container:"tp-weather-widget"})</script><div class="m_search"><form name="searchform" class="form u-search-form"><i class="icon fas fa-search fa-fw"></i> <input type="text" class="input u-search-input" placeholder="Search..."></form></div><ul class="switcher nav-list-h m-phone"><li><a class="s-search fas fa-search fa-fw" target="_self" href="javascript:void(0)" rel="external nofollow noreferrer"></a></li><li><a class="s-menu fas fa-bars fa-fw" target="_self" href="javascript:void(0)" rel="external nofollow noreferrer"></a><ul class="menu-phone list-v navigation white-box"><li><a class="menuitem flat-box faa-parent animated-hover" href="/" id="home"><i class="fas fa-home fa-fw"></i> Home</a></li><li><a class="menuitem flat-box faa-parent animated-hover"><i class="fas fa-th-list fa-fw"></i> Articles</a><ul class="list-v"><li><a class="menuitem flat-box faa-parent animated-hover" href="/categories/" id="categories"><i class="fas fa-folder-open fa-fw"></i> Categories</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/tags/" id="tags"><i class="fas fa-tags fa-fw"></i> Tags</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/archives/" id="archives"><i class="fas fa-archive fa-fw"></i> Archives</a></li></ul></li><li><a class="menuitem flat-box faa-parent animated-hover"><i class="fas fa-fan faa-spin animated fa-fw"></i> Play</a><ul class="list-v"><li><a class="menuitem flat-box faa-parent animated-hover" href="/catchTheCat/" id="catchTheCat"><i class="fas fa-cat faa-wrench animated-hover fa-fw"></i> Chat Noir</a></li></ul></li><li><a class="menuitem flat-box faa-parent animated-hover"><i class="fas fa-cog fa-spin fa-fw"></i> Tools</a><ul class="list-v"><li><a class="menuitem flat-box header toggle-mode-btn"><i class="fas fa-moon fa-fw"></i> 暗黑模式</a></li><li></li></ul></li><li><a class="menuitem flat-box faa-parent animated-hover"><i class="fas fa-info-circle fa-fw"></i> Me</a><ul class="list-v"><li><a class="menuitem flat-box faa-parent animated-hover" href="/about/" id="about"><i class="fas fa-ellipsis-v fa-fw"></i> About</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="https://aner1001.gitee.io/resume/" target="_blank" id="https:aner1001giteeioresume"><i class="fas fa-clock fa-fw"></i> Resume</a></li></ul></li></ul></li></ul></div></div></div></header><div id="l_body"><div id="l_cover"><div id="full" class="cover-wrapper post blank" style="display:none"><div id="cover-backstretch"></div><div id="scroll-down" style="display:none"><i class="fa fa-chevron-down scroll-down-effects"></i></div></div></div><div id="safearea"><div class="body-wrapper" id="pjax-container"><div class="l_main"><article class="article post white-box reveal md shadow article-type-post" id="post" itemscope itemprop="blogPost"><div class="article-meta" id="top"><h1 class="title"> Hexo搭建个人博客</h1><div class="new-meta-box"><div class="new-meta-item author"> <a class="author" href="/" rel="nofollow"><img no-lazy src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/img/cover/fav/cf_1o_x16.jpg"><p>汤晔飞</p></a></div><div class="new-meta-item category"><a class="notlink"><i class="fas fa-folder-open fa-fw" aria-hidden="true"></i> <a class="category-link" href="/categories/%E6%8A%80%E6%9C%AF%E7%9F%A5%E8%AF%86/">技术知识</a><span class="sep"></span><a class="category-link" href="/categories/%E6%8A%80%E6%9C%AF%E7%9F%A5%E8%AF%86/%E8%84%9A%E6%9C%AC/">脚本</a></a></div><div class="new-meta-item date"><a class="notlink"><i class="fas fa-calendar-alt fa-fw" aria-hidden="true"></i><p>发布于：2021年6月5日</p></a></div><div class="new-meta-item browse leancloud"><a class="notlink"><div id="lc-pv" data-title="Hexo搭建个人博客" data-path="/posts/2021/06/05/fe58c35af835/"><i class="fas fa-eye fa-fw" aria-hidden="true"></i><span id="number"><i class="fas fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i></span> 次浏览</div></a></div></div></div><p>本人的博客最终选择了Hexo，原因：</p><ol><li>强大的社区，基本什么问题都能查到，网上各种主题模板资料很全，各种QQ群一起high，讨论。</li><li>插件功能强大，技术成熟，使用起来很方便，从而封装性很好。</li><li>也能使用自动化部署技术GitHubActions或者TravisCi技术,弥补了相对于Jekyll博客能在Github自动部署的缺点。</li><li>使用Hexo能让你学习到很多东西。例如git知识、自动化部署等、第三方工具、在线编辑、云等等。</li></ol><span id="more"></span><h2 id="Hexo搭建博客-快速上手"><a class="header-anchor" href="#Hexo搭建博客-快速上手">☀</a>Hexo搭建博客(快速上手)</h2><h3 id="hexo安装"><a class="header-anchor" href="#hexo安装">☀</a>hexo安装</h3><ol><li><p>执行安装命令：<code>cnpm install -g hexo-cli</code></p></li><li><p>验证安装<code>hexo -v</code>。</p></li></ol><h3 id="基本命令本地创建博客"><a class="header-anchor" href="#基本命令本地创建博客">☀</a>基本命令本地创建博客</h3><p><strong><code>hexo init</code></strong></p><p>​ 初始化目录，变为hexo博客目录，内容为hexo基础的框架内容。</p><p><strong><code>cnpm install</code></strong></p><p>​ npm安装可能会失败，使用国内cnpm安装package.json依赖。</p><p><strong><code>hexo s</code></strong></p><p>​ 启动博客</p><p><strong><code>hexo n blogname</code></strong></p><p>创建一篇博客</p><p><strong><code>hexo clean</code></strong></p><p>​ 清理生成的html博客文件，一般生成之前都需要清理。</p><p><strong><code>hexo g</code></strong></p><p>​ hexo根据md文件，生成html博客。</p><h3 id="将博客部署远端"><a class="header-anchor" href="#将博客部署远端">☀</a>将博客部署远端</h3><p><strong><code>cnpm install --save hexo-deployer-git</code></strong></p><p>​ 安装hexo的部署依赖包</p><p><strong><code>修改_config.yml deply参数</code></strong></p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">deploy:</span></span><br><span class="line">	<span class="string">type:git</span></span><br><span class="line">	<span class="string">repo:仓库地址</span></span><br><span class="line">	<span class="string">branch:master</span></span><br></pre></td></tr></table></figure><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">deploy:</span></span><br><span class="line">  <span class="attr">type:</span> <span class="string">&#x27;git&#x27;</span></span><br><span class="line">  <span class="attr">repo:</span></span><br><span class="line">    <span class="attr">github:</span></span><br><span class="line">      <span class="attr">url:</span> <span class="string">https://github.com/aner1001/blog3.git</span></span><br><span class="line">      <span class="attr">branch:</span> <span class="string">gh-pages</span></span><br><span class="line">      <span class="attr">token:</span> <span class="string">$HEXO-GITHUB-TOKEN</span>					<span class="comment">#读取系统中的环境变量</span></span><br></pre></td></tr></table></figure><p><code>hexo d</code></p><p>​ 执行命令，将本地生成好的博客部署到远端。</p><h3 id="更换主题"><a class="header-anchor" href="#更换主题">☀</a>更换主题</h3><p>yilia主题为例：</p><p><strong><code>$ git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia</code></strong></p><p>​ 将博客克隆到当前blog博客目录下的，themes主题文件夹，yilia文件夹下。</p><p><strong><code>修改_config.yml theme参数</code></strong></p><figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">theme:yilia</span></span><br></pre></td></tr></table></figure><p><strong><code>hexo clean</code></strong></p><p>​ 重新清理博客。</p><p><strong><code>hexo g</code></strong></p><p>​ 重新生成博客。</p><p><code>hexo d</code></p><p>​ 重新发布博客。</p><h3 id="根目录设置"><a class="header-anchor" href="#根目录设置">☀</a>根目录设置</h3><p>如果博客并非部署在端口号对应的根目录下。则需要修改博客部署的根目录，所有文件都是基于这个根目录访问。<img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2020/12/20/20201220121514.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2020/12/20/20201220121514.png" srcset="" alt="image-20201220121513980"></p><p>本地启动时，会在端口号后拼接上根目录的路径。</p><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2020/12/20/20201220122105.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2020/12/20/20201220122105.png" srcset="" alt="image-20201220122105744"></p><p>这样就可已解决，万一博客不是在服务器根目录造成的问题。</p><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2020/12/20/20201220122234.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2020/12/20/20201220122234.png" srcset="" alt="image-20201220122234457"></p><h2 id="Hexo配置-config-yml"><a class="header-anchor" href="#Hexo配置-config-yml">☀</a>Hexo配置_config.yml</h2><h3 id="参数纪要"><a class="header-anchor" href="#参数纪要">☀</a>参数纪要</h3><p>记录一些个人认为比较有用的参数，详细参数文档请看<a target="_blank" rel="noopener external nofollow noreferrer" href="https://hexo.io/zh-cn/docs/">Hexo官方参数文档</a></p><h4 id="site网站参数"><a class="header-anchor" href="#site网站参数">☀</a>#site网站参数</h4><table><thead><tr><th>参数</th><th>说明</th></tr></thead><tbody><tr><td><code>title</code></td><td>网站标题</td></tr><tr><td><code>subtitle</code></td><td>网站副标题</td></tr><tr><td><code>description</code></td><td>网站描述，主要用于SEO，告诉搜索引擎一个关于您站点的简单描述，通常建议在其中包含您网站的关键词。</td></tr><tr><td><code>keywords</code></td><td>网站的关键词。支援多个关键词。</td></tr><tr><td><code>author</code></td><td>您的名字，用于主题显示文章的作者。</td></tr><tr><td><code>language</code></td><td>网站使用的语言。对于简体中文用户来说，使用不同的主题可能需要设置成不同的值，请参考你的主题的文档自行设置，常见的有 <code>zh-Hans</code>和 <code>zh-CN</code>。</td></tr><tr><td><code>timezone</code></td><td>网站时区。Hexo 默认使用您电脑的时区。请参考 <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">时区列表</a> 进行设置，如 <code>America/New_York</code>, <code>Japan</code>, 和 <code>UTC</code> 。一般的，对于中国大陆地区可以使用 <code>Asia/Shanghai</code>。</td></tr></tbody></table><h4 id="URL网址参数"><a class="header-anchor" href="#URL网址参数">☀</a>#URL网址参数</h4><table><thead><tr><th>参数</th><th>说明</th></tr></thead><tbody><tr><td><code>url</code></td><td>网址, must starts with <code>http://</code> or <code>https://</code><br>如果您的网站存放在子目录中，例如 <code>http://example.com/blog</code>，则请将您的 <code>url</code> 设为 <code>http://example.com/blog</code> 并把 <code>root</code> 设为 <code>/blog/</code>。</td></tr><tr><td><code>root</code></td><td>网站根目录</td></tr><tr><td>…</td><td>…</td></tr></tbody></table><h4 id="Directory目录参数"><a class="header-anchor" href="#Directory目录参数">☀</a>#Directory目录参数</h4><table><thead><tr><th>参数</th><th>说明</th></tr></thead><tbody><tr><td><code>skip_render</code></td><td>用于source目录中的文件跳过指定文件的渲染。匹配到的文件将会被不做改动地复制到 <code>public</code> 目录中。您可使用 <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/micromatch/micromatch#extended-globbing">glob 表达式</a>来匹配路径。</td></tr></tbody></table><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">skip_render:</span> <span class="string">&quot;mypage/**/*&quot;</span></span><br><span class="line"><span class="comment"># 将会直接将 `source/mypage/index.html` 和 `source/mypage/code.js` 不做改动地输出到 &#x27;public&#x27; 目录</span></span><br><span class="line"><span class="comment"># 你也可以用这种方法来跳过对指定文章文件的渲染</span></span><br><span class="line"><span class="attr">skip_render:</span> <span class="string">&quot;_posts/test-post.md&quot;</span></span><br><span class="line"><span class="comment"># 这将会忽略对 &#x27;test-post.md&#x27; 的渲染</span></span><br></pre></td></tr></table></figure><h4 id="Writing写作文章的参数"><a class="header-anchor" href="#Writing写作文章的参数">☀</a>#Writing写作文章的参数</h4><table><thead><tr><th style="text-align:left">参数</th><th style="text-align:left">描述</th><th style="text-align:left">默认值</th></tr></thead><tbody><tr><td style="text-align:left"><code>new_post_name</code></td><td style="text-align:left">新文章的文件名称格式。</td><td style="text-align:left">:title.md</td></tr><tr><td style="text-align:left"><code>default_layout</code></td><td style="text-align:left">预设布局，未指定布局创建时使用默认布局。</td><td style="text-align:left">post</td></tr><tr><td style="text-align:left"><code>external_link</code></td><td style="text-align:left">在新标签中打开链接</td><td style="text-align:left">true</td></tr><tr><td style="text-align:left"><code>external_link.enable</code></td><td style="text-align:left">在新标签中打开链接</td><td style="text-align:left">true</td></tr><tr><td style="text-align:left"><code>external_link.field</code></td><td style="text-align:left">对整个网站（<code>site</code>）生效或仅对文章（<code>post</code>）生效</td><td style="text-align:left">site</td></tr><tr><td style="text-align:left"><code>external_link.exclude</code></td><td style="text-align:left">需要排除的域名。主域名和子域名如 <code>www</code> 需分别配置</td><td style="text-align:left">[]</td></tr><tr><td style="text-align:left"><code>render_drafts</code></td><td style="text-align:left">显示草稿</td><td style="text-align:left">false</td></tr><tr><td style="text-align:left"><code>post_asset_folder</code></td><td style="text-align:left">启动 <a target="_blank" rel="noopener external nofollow noreferrer" href="https://hexo.io/zh-cn/docs/asset-folders">Asset 文件夹</a>。用于存放文章的图片等资源。</td><td style="text-align:left">false</td></tr></tbody></table><h4 id="Date-Time-format日期格式参数"><a class="header-anchor" href="#Date-Time-format日期格式参数">☀</a>#Date / Time format日期格式参数</h4><table><thead><tr><th style="text-align:left">参数</th><th style="text-align:left">描述</th><th style="text-align:left">默认值</th></tr></thead><tbody><tr><td style="text-align:left"><code>date_format</code></td><td style="text-align:left">日期格式</td><td style="text-align:left"><code>YYYY-MM-DD</code></td></tr><tr><td style="text-align:left"><code>time_format</code></td><td style="text-align:left">时间格式</td><td style="text-align:left"><code>HH:mm:ss</code></td></tr><tr><td style="text-align:left"><code>updated_option</code></td><td style="text-align:left">当 Front Matter 中没有指定 <a target="_blank" rel="noopener external nofollow noreferrer" href="https://hexo.io/zh-cn/docs/variables#%E9%A1%B5%E9%9D%A2%E5%8F%98%E9%87%8F"><code>updated</code></a> 时 <code>updated</code> 的取值</td><td style="text-align:left"><code>mtime</code></td></tr></tbody></table><blockquote><p><strong>updated_option</strong></p><p><code>updated_option</code> 控制了当 Front Matter 中没有指定 <code>updated</code> 时，<code>updated</code> 如何取值：</p><ul><li><code>mtime</code>: 使用文件的最后修改时间。这是从 Hexo 3.0.0 开始的默认行为。</li><li><code>date</code>: 使用 <code>date</code> 作为 <code>updated</code> 的值。可被用于 Git 工作流之中，因为使用 Git 管理站点时，文件的最后修改日期常常会发生改变。在 Git 工作流中这个选项会很有用 。</li><li><code>empty</code>: 直接删除 <code>updated</code>。使用这一选项可能会导致大部分主题和插件无法正常工作。</li></ul></blockquote><h4 id="Extensions-Plugins-Themes-Deployment主题，拓展，发布等参数"><a class="header-anchor" href="#Extensions-Plugins-Themes-Deployment主题，拓展，发布等参数">☀</a>#Extensions/Plugins/Themes/Deployment主题，拓展，发布等参数</h4><table><thead><tr><th style="text-align:left">参数</th><th style="text-align:left">描述</th></tr></thead><tbody><tr><td style="text-align:left"><code>theme</code></td><td style="text-align:left">当前主题名称。值为<code>false</code>时禁用主题</td></tr><tr><td style="text-align:left"><code>theme_config</code></td><td style="text-align:left">主题的配置文件。在这里放置的配置会覆盖主题目录下的 <code>_config.yml</code> 中的配置</td></tr><tr><td style="text-align:left"><code>deploy</code></td><td style="text-align:left">部署部分的设置</td></tr><tr><td style="text-align:left"><code>meta_generator</code></td><td style="text-align:left"><a target="_blank" rel="noopener external nofollow noreferrer" href="https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/meta#%E5%B1%9E%E6%80%A7">Meta generator</a> 标签。 值为 <code>false</code> 时 Hexo 不会在头部插入该标签</td></tr></tbody></table><h4 id="包括或不包括目录和文件-Include-Exclude-file-s"><a class="header-anchor" href="#包括或不包括目录和文件-Include-Exclude-file-s">☀</a>#包括或不包括目录和文件# Include / Exclude file(s)</h4><table><thead><tr><th style="text-align:left">参数</th><th style="text-align:left">描述</th></tr></thead><tbody><tr><td style="text-align:left"><code>include</code></td><td style="text-align:left">Hexo 默认会忽略隐藏文件和文件夹（包括名称以下划线和 <code>.</code> 开头的文件和文件夹，Hexo 的 <code>_posts</code> 和 <code>_data</code> 等目录除外）。通过设置此字段将使 Hexo 处理他们并将它们复制到 <code>source</code> 目录下。</td></tr><tr><td style="text-align:left"><code>exclude</code></td><td style="text-align:left">Hexo 会忽略这些文件和目录</td></tr><tr><td style="text-align:left"><code>ignore</code></td><td style="text-align:left">Ignore files/folders</td></tr></tbody></table><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Include/Exclude Files/Folders</span></span><br><span class="line"><span class="attr">include:</span></span><br><span class="line">  <span class="bullet">-</span> <span class="string">&quot;.nojekyll&quot;</span></span><br><span class="line">  <span class="comment"># 包括 &#x27;source/css/_typing.css&#x27;</span></span><br><span class="line">  <span class="bullet">-</span> <span class="string">&quot;css/_typing.css&quot;</span></span><br><span class="line">  <span class="comment"># 包括 &#x27;source/_css/&#x27; 中的任何文件，但不包括子目录及其其中的文件。</span></span><br><span class="line">  <span class="bullet">-</span> <span class="string">&quot;_css/*&quot;</span></span><br><span class="line">  <span class="comment"># 包含 &#x27;source/_css/&#x27; 中的任何文件和子目录下的任何文件</span></span><br><span class="line">  <span class="bullet">-</span> <span class="string">&quot;_css/**/*&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="attr">exclude:</span></span><br><span class="line">  <span class="comment"># 不包括 &#x27;source/js/test.js&#x27;</span></span><br><span class="line">  <span class="bullet">-</span> <span class="string">&quot;js/test.js&quot;</span></span><br><span class="line">  <span class="comment"># 不包括 &#x27;source/js/&#x27; 中的文件、但包括子目录下的所有目录和文件</span></span><br><span class="line">  <span class="bullet">-</span> <span class="string">&quot;js/*&quot;</span></span><br><span class="line">  <span class="comment"># 不包括 &#x27;source/js/&#x27; 中的文件和子目录下的任何文件</span></span><br><span class="line">  <span class="bullet">-</span> <span class="string">&quot;js/**/*&quot;</span></span><br><span class="line">  <span class="comment"># 不包括 &#x27;source/js/&#x27; 目录下的所有文件名以 &#x27;test&#x27; 开头的文件，但包括其它文件和子目录下的单文件</span></span><br><span class="line">  <span class="bullet">-</span> <span class="string">&quot;js/test*&quot;</span></span><br><span class="line">  <span class="comment"># 不包括 &#x27;source/js/&#x27; 及其子目录中任何以 &#x27;test&#x27; 开头的文件</span></span><br><span class="line">  <span class="bullet">-</span> <span class="string">&quot;js/**/test*&quot;</span></span><br><span class="line">  <span class="comment"># 不要用 exclude 来忽略 &#x27;source/_posts/&#x27; 中的文件。你应该使用 &#x27;skip_render&#x27;，或者在要忽略的文件的文件名之前加一个下划线 &#x27;_&#x27;</span></span><br><span class="line">  <span class="comment"># 在这里配置一个 - &quot;_posts/hello-world.md&quot; 是没有用的。</span></span><br><span class="line"></span><br><span class="line"><span class="attr">ignore:</span></span><br><span class="line">  <span class="comment"># Ignore any folder named &#x27;foo&#x27;.</span></span><br><span class="line">  <span class="bullet">-</span> <span class="string">&quot;**/foo&quot;</span></span><br><span class="line">  <span class="comment"># Ignore &#x27;foo&#x27; folder in &#x27;themes/&#x27; only.</span></span><br><span class="line">  <span class="bullet">-</span> <span class="string">&quot;**/themes/*/foo&quot;</span></span><br><span class="line">  <span class="comment"># Same as above, but applies to every subfolders of &#x27;themes/&#x27;.</span></span><br><span class="line">  <span class="bullet">-</span> <span class="string">&quot;**/themes/**/foo&quot;</span></span><br></pre></td></tr></table></figure><blockquote><p>列表中的每一项都必须用单引号或双引号包裹起来。</p><p><code>include</code> 和 <code>exclude</code> 并不适用于 <code>themes/</code> 目录下的文件。如果需要忽略 <code>themes/</code> 目录下的部分文件或文件夹，可以使用 <code>ignore</code> 或在文件名之前添加下划线 <code>_</code>。</p></blockquote><h4 id="永久链接（Permalinks）"><a class="header-anchor" href="#永久链接（Permalinks）">☀</a>#永久链接（Permalinks）</h4><p>您可以在 <code>_config.yml</code> 配置中调整网站的永久链接或者在每篇文章的 Front-matter 中指定。</p><h4 id="变量"><a class="header-anchor" href="#变量">☀</a>变量</h4><p>除了下列变量外，您还可使用 Front-matter 中的所有属性。</p><table><thead><tr><th style="text-align:left">变量</th><th style="text-align:left">描述</th></tr></thead><tbody><tr><td style="text-align:left"><code>:year</code></td><td style="text-align:left">文章的发表年份（4 位数）</td></tr><tr><td style="text-align:left"><code>:month</code></td><td style="text-align:left">文章的发表月份（2 位数）</td></tr><tr><td style="text-align:left"><code>:i_month</code></td><td style="text-align:left">文章的发表月份（去掉开头的零）</td></tr><tr><td style="text-align:left"><code>:day</code></td><td style="text-align:left">文章的发表日期 (2 位数)</td></tr><tr><td style="text-align:left"><code>:i_day</code></td><td style="text-align:left">文章的发表日期（去掉开头的零）</td></tr><tr><td style="text-align:left"><code>:hour</code></td><td style="text-align:left">文章发表时的小时 (2 位数)</td></tr><tr><td style="text-align:left"><code>:minute</code></td><td style="text-align:left">文章发表时的分钟 (2 位数)</td></tr><tr><td style="text-align:left"><code>:second</code></td><td style="text-align:left">文章发表时的秒钟 (2 位数)</td></tr><tr><td style="text-align:left"><code>:title</code></td><td style="text-align:left">文件名称 (relative to “source/_posts/“ folder)</td></tr><tr><td style="text-align:left"><code>:name</code></td><td style="text-align:left">文件名称</td></tr><tr><td style="text-align:left"><code>:post_title</code></td><td style="text-align:left">文章标题</td></tr><tr><td style="text-align:left"><code>:id</code></td><td style="text-align:left">文章 ID (<em>not persistent across <a target="_blank" rel="noopener external nofollow noreferrer" href="https://hexo.io/zh-cn/docs/commands#clean">cache reset</a></em>)</td></tr><tr><td style="text-align:left"><code>:category</code></td><td style="text-align:left">分类。如果文章没有分类，则是 <code>default_category</code> 配置信息。</td></tr><tr><td style="text-align:left"><code>:hash</code></td><td style="text-align:left">SHA1 hash of filename (same as <code>:title</code>) and date (12-hexadecimal)</td></tr></tbody></table><p>您可在 <code>permalink_defaults</code> 参数下调整永久链接中各变量的默认值：</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">permalink_defaults:</span></span><br><span class="line">  <span class="attr">lang:</span> <span class="string">en</span></span><br></pre></td></tr></table></figure><p>示例</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">source/_posts/hello-world.mdtitle:</span> <span class="string">Hello</span> <span class="string">World</span></span><br><span class="line"><span class="attr">date:</span> <span class="number">2013-07-14 17:01:34</span></span><br><span class="line"><span class="attr">categories:</span></span><br><span class="line"><span class="bullet">-</span> <span class="string">foo</span></span><br><span class="line"><span class="bullet">-</span> <span class="string">bar</span></span><br></pre></td></tr></table></figure><table><thead><tr><th style="text-align:left">参数</th><th style="text-align:left">结果</th></tr></thead><tbody><tr><td style="text-align:left"><code>:year/:month/:day/:title/</code></td><td style="text-align:left">2013/07/14/hello-world/</td></tr><tr><td style="text-align:left"><code>:year-:month-:day-:title.html</code></td><td style="text-align:left">2013-07-14-hello-world.html</td></tr><tr><td style="text-align:left"><code>:category/:title/</code></td><td style="text-align:left">foo/bar/hello-world/</td></tr><tr><td style="text-align:left"><code>:title-:hash/</code></td><td style="text-align:left">hello-world-a2c8ac003b43/</td></tr></tbody></table><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">source/_posts/lorem/hello-world.mdtitle:</span> <span class="string">Hello</span> <span class="string">World</span></span><br><span class="line"><span class="attr">date:</span> <span class="number">2013-07-14 17:01:34</span></span><br><span class="line"><span class="attr">categories:</span></span><br><span class="line"><span class="bullet">-</span> <span class="string">foo</span></span><br><span class="line"><span class="bullet">-</span> <span class="string">bar</span></span><br></pre></td></tr></table></figure><table><thead><tr><th style="text-align:left">参数</th><th style="text-align:left">结果</th></tr></thead><tbody><tr><td style="text-align:left"><code>:year/:month/:day/:title/</code></td><td style="text-align:left">2013/07/14/lorem/hello-world/</td></tr><tr><td style="text-align:left"><code>:year/:month/:day/:name/</code></td><td style="text-align:left">2013/07/14/hello-world/</td></tr></tbody></table><h5 id="多语种支持"><a class="header-anchor" href="#多语种支持">☀</a>多语种支持</h5><p>若要建立一个多语种的网站，您可修改 <code>new_post_name</code> 和 <code>permalink</code> 参数，如下：</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">new_post_name:</span> <span class="string">:lang/:title.md</span></span><br><span class="line"><span class="attr">permalink:</span> <span class="string">:lang/:title/</span></span><br></pre></td></tr></table></figure><p>当您建立新文章时，文章会被储存到：</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new &quot;Hello World&quot; --lang tw</span><br><span class="line"># =&gt; source/_posts/tw/Hello-World.md</span><br></pre></td></tr></table></figure><p>而网址会是：</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">http://localhost:4000/tw/hello-world/</span><br></pre></td></tr></table></figure><h3 id="配置文件合并原理"><a class="header-anchor" href="#配置文件合并原理">☀</a>配置文件合并原理</h3><h4 id="使用代替配置文件"><a class="header-anchor" href="#使用代替配置文件">☀</a>使用代替配置文件</h4><p>可以在 hexo-cli 中使用 <code>--config</code> 参数来指定自定义配置文件的路径。你可以使用一个 YAML 或 JSON 文件的路径，也可以使用逗号分隔（无空格）的多个 YAML 或 JSON 文件的路径。例如：</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"># use &#x27;custom.yml&#x27; in place of &#x27;_config.yml&#x27;</span><br><span class="line">$ hexo server --config custom.yml</span><br><span class="line"></span><br><span class="line"># use &#x27;custom.yml&#x27; &amp; &#x27;custom2.json&#x27;, prioritizing &#x27;custom3.yml&#x27;, then &#x27;custom2.json&#x27;</span><br><span class="line">$ hexo generate --config custom.yml,custom2.json,custom3.yml</span><br></pre></td></tr></table></figure><p>当你指定了多个配置文件以后，Hexo 会按顺序将这部分配置文件合并成一个 <code>_multiconfig.yml</code>。如果遇到重复的配置，排在后面的文件的配置会覆盖排在前面的文件的配置。这个原则适用于任意数量、任意深度的 YAML 和 JSON 文件。</p><p>例如，使用 <code>--options</code> 指定了两个自定义配置文件：</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo generate --config custom.yml,custom2.json</span><br></pre></td></tr></table></figure><p>如果 <code>custom.yml</code> 中指定了 <code>foo: bar</code>，在 custom2.json 中指定了 <code>&quot;foo&quot;: &quot;dinosaur&quot;</code>，那么在 <code>_multiconfig.yml</code> 中你会得到 <code>foo: dinosaur</code>。</p><p><strong>♣注：一般直接使用hexo根目录下的_config.yml。</strong></p><h4 id="使用代替主题配置文件"><a class="header-anchor" href="#使用代替主题配置文件">☀</a>使用代替主题配置文件</h4><p>通常情况下，Hexo 主题是一个独立的项目，并拥有一个独立的 <code>_config.yml</code> 配置文件。</p><p>除了自行维护独立的主题配置文件，你也可以在其它地方对主题进行配置。</p><p><strong>配置文件中的 <code>theme_config</code></strong></p><blockquote><p>该特性自 Hexo 2.8.2 起提供</p></blockquote><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"># _config.yml</span><br><span class="line">theme: &quot;my-theme&quot;</span><br><span class="line">theme_config:</span><br><span class="line">  bio: &quot;My awesome bio&quot;</span><br><span class="line">  foo:</span><br><span class="line">    bar: &#x27;a&#x27;</span><br><span class="line"># themes/my-theme/_config.yml</span><br><span class="line">bio: &quot;Some generic bio&quot;</span><br><span class="line">logo: &quot;a-cool-image.png&quot;</span><br><span class="line">  foo:</span><br><span class="line">    baz: &#x27;b&#x27;</span><br></pre></td></tr></table></figure><p>最终主题配置的输出是：</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">  bio: &quot;My awesome bio&quot;,</span><br><span class="line">  logo: &quot;a-cool-image.png&quot;,</span><br><span class="line">  foo: &#123;</span><br><span class="line">    bar: &quot;a&quot;,</span><br><span class="line">    baz: &quot;b&quot;</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p><strong>独立的 <code>_config.[theme].yml</code> 文件</strong></p><blockquote><p>该特性自 Hexo 5.0.0 起提供</p></blockquote><p>独立的主题配置文件应放置于站点根目录下，支持 <code>yml</code> 或 <code>json</code> 格式。需要配置站点 <code>_config.yml</code> 文件中的 <code>theme</code> 以供 Hexo 寻找 <code>_config.[theme].yml</code> 文件。</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"># _config.yml</span><br><span class="line">theme: &quot;my-theme&quot;</span><br><span class="line"># _config.my-theme.yml</span><br><span class="line">bio: &quot;My awesome bio&quot;</span><br><span class="line">foo:</span><br><span class="line">  bar: &#x27;a&#x27;</span><br><span class="line"># themes/my-theme/_config.yml</span><br><span class="line">bio: &quot;Some generic bio&quot;</span><br><span class="line">logo: &quot;a-cool-image.png&quot;</span><br><span class="line">  foo:</span><br><span class="line">    baz: &#x27;b&#x27;</span><br></pre></td></tr></table></figure><p>最终主题配置的输出是：</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">  bio: &quot;My awesome bio&quot;,</span><br><span class="line">  logo: &quot;a-cool-image.png&quot;,</span><br><span class="line">  foo: &#123;</span><br><span class="line">    bar: &quot;a&quot;,</span><br><span class="line">    baz: &quot;b&quot;</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><blockquote><p>我们强烈建议你将所有的主题配置集中在一处。如果你不得不在多处配置你的主题，那么这些信息对你将会非常有用：Hexo 在合并主题配置时，Hexo 配置文件中的 <code>theme_config</code> 的优先级最高，其次是 <code>_config.[theme].yml</code> 文件，最后是位于主题目录下的 <code>_config.yml</code> 文件。</p></blockquote><p><strong>♣注：针对主题的配置，基本上直接新建使用hexo根目录下_config.[theme].yml，统一处理。不修改主题，目录下的_config.yml</strong></p><h2 id="Hexo命令"><a class="header-anchor" href="#Hexo命令">☀</a>Hexo命令</h2><p><strong>♣注：一定要先写关键字主命令后再写参数。</strong></p><h3 id="init"><a class="header-anchor" href="#init">☀</a>init</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo init [folder]</span><br></pre></td></tr></table></figure><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo init</span><br></pre></td></tr></table></figure><p>新建一个网站。如果没有设置 <code>folder</code> ，Hexo 默认在目前的文件夹建立网站。</p><h3 id="new"><a class="header-anchor" href="#new">☀</a>new</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new [layout] &lt;title&gt;</span><br></pre></td></tr></table></figure><p>新建一篇文章。如果没有设置 <code>layout</code> 的话，默认使用 <a target="_blank" rel="noopener external nofollow noreferrer" href="https://hexo.io/zh-cn/docs/configuration">_config.yml</a> 中的 <code>default_layout</code> 参数代替。如果标题包含空格的话，请使用引号括起来。</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new &quot;post title with whitespace&quot;</span><br></pre></td></tr></table></figure><table><thead><tr><th style="text-align:left">参数</th><th style="text-align:left">描述</th></tr></thead><tbody><tr><td style="text-align:left">★<code>-p</code>, <code>--path</code></td><td style="text-align:left">自定义新文章的路径</td></tr><tr><td style="text-align:left"><code>-r</code>, <code>--replace</code></td><td style="text-align:left">如果存在同名文章，将其替换</td></tr><tr><td style="text-align:left"><code>-s</code>, <code>--slug</code></td><td style="text-align:left">文章的 Slug，作为新文章的文件名和发布后的 URL</td></tr></tbody></table><p>默认情况下，Hexo 会使用文章的标题来决定文章文件的路径。对于独立页面来说，Hexo 会创建一个以标题为名字的目录，并在目录中放置一个 <code>index.md</code> 文件。你可以使用 <code>--path</code> 参数来覆盖上述行为、自行决定文件的目录：</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo new page --path about/me &quot;About me&quot;</span><br></pre></td></tr></table></figure><p>以上命令会创建一个 <code>source/about/me.md</code> 文件，同时 Front Matter 中的 title 为 <code>&quot;About me&quot;</code></p><p><strong>注意：指定目录后，文件名会以最后一层目录下的名称me作为文件名。</strong></p><p><strong>♠个人心得:为何要这样生成？md文件最后渲染的就是一个md文件名称的目录，其中有个index.html。</strong></p><p>注意！title 是必须指定的！如果你这么做并不能达到你的目的：</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo new page --path about/me</span><br></pre></td></tr></table></figure><p>此时 Hexo 会创建 <code>source/_posts/about/me.md</code>，同时 <code>me.md</code> 的 Front Matter 中的 title 为 <code>&quot;page&quot;</code>。这是因为在上述命令中，hexo-cli 将 <code>page</code> 视为指定文章的标题、并采用默认的 <code>layout</code>。</p><p><strong>注意：如果标题中有特殊字符如<code>[]</code>,必须带上’'符号括起来.</strong></p><h3 id="generate"><a class="header-anchor" href="#generate">☀</a>generate</h3><p>生成静态文件。</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$ hexo generate</span><br><span class="line">#简写为</span><br><span class="line">$ hexo g</span><br></pre></td></tr></table></figure><table><thead><tr><th style="text-align:left">选项</th><th style="text-align:left">描述</th></tr></thead><tbody><tr><td style="text-align:left">★<code>-d</code>, <code>--deploy</code></td><td style="text-align:left">文件生成后立即部署网站</td></tr><tr><td style="text-align:left"><code>-w</code>, <code>--watch</code></td><td style="text-align:left">监视文件变动</td></tr><tr><td style="text-align:left"><code>-b</code>, <code>--bail</code></td><td style="text-align:left">生成过程中如果发生任何未处理的异常则抛出异常</td></tr><tr><td style="text-align:left">★<code>-f</code>, <code>--force</code></td><td style="text-align:left">强制重新生成文件 Hexo 引入了差分机制，<br>如果 <code>public</code> 目录存在，那么 <code>hexo g</code> 只会重新生成改动的文件。<br> 使用该参数的效果接近 <code>hexo clean &amp;&amp; hexo generate</code></td></tr><tr><td style="text-align:left"><code>-c</code>, <code>--concurrency</code></td><td style="text-align:left">最大同时生成文件的数量，默认无限制</td></tr></tbody></table><h3 id="publish"><a class="header-anchor" href="#publish">☀</a>publish</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo publish [layout] &lt;filename&gt;</span><br></pre></td></tr></table></figure><p>发表草稿。经过测试目前只能将darft目录下的文件添加到_post文件夹下。不支持子目录添加操作。</p><h3 id="server"><a class="header-anchor" href="#server">☀</a>server</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$ hexo server</span><br><span class="line">#简写为</span><br><span class="line">$ hexo s</span><br></pre></td></tr></table></figure><p>启动服务器。默认情况下，访问网址为： <code>http://localhost:4000/</code>。</p><table><thead><tr><th style="text-align:left">选项</th><th style="text-align:left">描述</th></tr></thead><tbody><tr><td style="text-align:left"><code>-p</code>, <code>--port</code></td><td style="text-align:left">重设端口</td></tr><tr><td style="text-align:left"><code>-s</code>, <code>--static</code></td><td style="text-align:left">只使用静态文件，使用public中的。generate之后生成的文件。</td></tr><tr><td style="text-align:left"><code>-l</code>, <code>--log</code></td><td style="text-align:left">启动日记记录，使用覆盖记录格式</td></tr><tr><td style="text-align:left"><code>--draft</code></td><td style="text-align:left">添加预览草稿文件</td></tr><tr><td style="text-align:left">-i</td><td style="text-align:left">指定访问Ip.服务器有双网口时，可用此选项覆盖默认的ip设置。</td></tr></tbody></table><p>服务启动后，文章中内容是实时渲染的。一旦改动立马会生效。不会使用静态public中generate生成后的文件。</p><h3 id="deploy"><a class="header-anchor" href="#deploy">☀</a>deploy</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$ hexo deploy</span><br><span class="line">#简写为</span><br><span class="line">$ hexo d</span><br></pre></td></tr></table></figure><p>部署网站。</p><table><thead><tr><th style="text-align:left">参数</th><th style="text-align:left">描述</th></tr></thead><tbody><tr><td style="text-align:left"><code>-g</code>, <code>--generate</code></td><td style="text-align:left">部署之前预先生成静态文件</td></tr></tbody></table><h3 id="render"><a class="header-anchor" href="#render">☀</a>render</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo render &lt;file1&gt; [file2] ...</span><br></pre></td></tr></table></figure><p>file需要指明目录。路径默认在的执行此命令的blog根目录中。</p><p>例：<code>hexo render source\_posts\about\me.md -o data</code></p><p>渲染文件。</p><table><thead><tr><th style="text-align:left">参数</th><th style="text-align:left">描述</th></tr></thead><tbody><tr><td style="text-align:left"><code>-o</code>, <code>--output</code></td><td style="text-align:left">设置输出路径</td></tr></tbody></table><h3 id="clean"><a class="header-anchor" href="#clean">☀</a>clean</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo clean</span><br></pre></td></tr></table></figure><p>清除缓存文件 (<code>db.json</code>) 和已生成的静态文件 (<code>public</code>)。</p><p>在某些情况（尤其是更换主题后），如果发现您对站点的更改无论如何也不生效，您可能需要运行该命令。</p><h3 id="list"><a class="header-anchor" href="#list">☀</a>list</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo list &lt;type&gt;</span><br></pre></td></tr></table></figure><p>列出网站资料，已经存在的文件等。</p><table><thead><tr><th>参数</th><th>列举</th></tr></thead><tbody><tr><td><type></type></td><td>page, post, route, tag, category</td></tr></tbody></table><h3 id="version"><a class="header-anchor" href="#version">☀</a>version</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$ hexo version</span><br><span class="line">#简写为</span><br><span class="line">$ hexo v</span><br></pre></td></tr></table></figure><p>显示 Hexo 版本。</p><h2 id="基本的操作"><a class="header-anchor" href="#基本的操作">☀</a>基本的操作</h2><h3 id="创建文章"><a class="header-anchor" href="#创建文章">☀</a>创建文章</h3><p>你可以执行下列命令来创建一篇新文章或者新的页面。</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new [layout] &lt;title&gt;</span><br></pre></td></tr></table></figure><p>您可以在命令中指定文章的布局（layout），默认为 <code>post</code>，可以通过修改 <code>_config.yml</code> 中的 <code>default_layout</code> 参数来指定默认布局。</p><h4 id="布局（Layout）"><a class="header-anchor" href="#布局（Layout）">☀</a>布局（Layout）</h4><p>Hexo 有三种默认布局：<code>post</code>、<code>page</code> 和 <code>draft</code>。在创建者三种不同类型的文件时，它们将会被保存到不同的路径；而您自定义的其他布局和 <code>post</code> 相同，都将储存到 <code>source/_posts</code> 文件夹。对应Scaffold文件夹中的post</p><p>.md、<a target="_blank" rel="noopener external nofollow noreferrer" href="http://page.md">page.md</a>、<a target="_blank" rel="noopener external nofollow noreferrer" href="http://draft.md">draft.md</a>。</p><table><thead><tr><th style="text-align:left">布局</th><th style="text-align:left">路径</th></tr></thead><tbody><tr><td style="text-align:left"><code>post</code></td><td style="text-align:left"><code>source/_posts</code></td></tr><tr><td style="text-align:left"><code>page</code></td><td style="text-align:left"><code>source</code></td></tr><tr><td style="text-align:left"><code>draft</code></td><td style="text-align:left"><code>source/_drafts</code></td></tr></tbody></table><blockquote><p>Disabling layout</p><p>If you don’t want an article (post/page) to be processed with a theme, set <code>layout: false</code> in its front-matter. Refer to <a target="_blank" rel="noopener external nofollow noreferrer" href="https://hexo.io/zh-cn/docs/front-matter#%E5%B8%83%E5%B1%80">this section</a> for more details.</p></blockquote><h4 id="自定义模版（Scaffold）"><a class="header-anchor" href="#自定义模版（Scaffold）">☀</a>自定义模版（Scaffold）</h4><p>在新建文章时，Hexo 会根据 <code>scaffolds</code> 文件夹内相对应的文件来建立文件，例如：</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new photo &quot;My Gallery&quot;</span><br></pre></td></tr></table></figure><p>在执行这行指令时，Hexo 会尝试在 <code>scaffolds</code> 文件夹中寻找 <code>photo.md</code>，并根据其内容建立文章，模版中使用的变量列举：</p><table><thead><tr><th style="text-align:left">变量</th><th style="text-align:left">描述</th></tr></thead><tbody><tr><td style="text-align:left"><code>layout</code></td><td style="text-align:left">布局</td></tr><tr><td style="text-align:left"><code>title</code></td><td style="text-align:left">标题</td></tr><tr><td style="text-align:left"><code>date</code></td><td style="text-align:left">文件建立日期</td></tr></tbody></table><h4 id="文件名称"><a class="header-anchor" href="#文件名称">☀</a>文件名称</h4><p>Hexo 默认以标题做为文件名称，但您可编辑 <code>new_post_name</code> 参数来改变默认的文件名称，举例来说，设为 <code>:year-:month-:day-:title.md</code> 可让您更方便的通过日期来管理文章。</p><table><thead><tr><th style="text-align:left">变量</th><th style="text-align:left">描述</th></tr></thead><tbody><tr><td style="text-align:left"><code>:title</code></td><td style="text-align:left">标题（小写，空格将会被替换为短杠）</td></tr><tr><td style="text-align:left"><code>:year</code></td><td style="text-align:left">建立的年份，比如， <code>2015</code></td></tr><tr><td style="text-align:left"><code>:month</code></td><td style="text-align:left">建立的月份（有前导零），比如， <code>04</code></td></tr><tr><td style="text-align:left"><code>:i_month</code></td><td style="text-align:left">建立的月份（无前导零），比如， <code>4</code></td></tr><tr><td style="text-align:left"><code>:day</code></td><td style="text-align:left">建立的日期（有前导零），比如， <code>07</code></td></tr><tr><td style="text-align:left"><code>:i_day</code></td><td style="text-align:left">建立的日期（无前导零），比如， <code>7</code></td></tr></tbody></table><h3 id="写作"><a class="header-anchor" href="#写作">☀</a>写作</h3><h4 id="写作语言格式"><a class="header-anchor" href="#写作语言格式">☀</a>写作语言格式</h4><p>不仅可以用 Markdown 写作，你还可以用 EJS 写作。甚至可以用 Pug 模板语言书写文章。需要渲染插件的支持，<code>hexo-renderer-marked</code> 和 <code>hexo-renderer-ejs</code>默认已安装。hexo-renderer-pug安装后可渲染Pug。</p><h4 id="Front-matter文章前提"><a class="header-anchor" href="#Front-matter文章前提">☀</a>Front-matter文章前提</h4><p>Front-matter 是文件最上方以 <code>---</code> 分隔的区域，用于指定个别文件的变量，举例来说：</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line">title: Hello World</span><br><span class="line">date: 2013/7/13 20:46:25</span><br><span class="line">---</span><br></pre></td></tr></table></figure><p>以下是预先定义的参数，您可在模板中使用这些参数值并加以利用。</p><table><thead><tr><th style="text-align:left">参数</th><th style="text-align:left">描述</th><th style="text-align:left">默认值</th></tr></thead><tbody><tr><td style="text-align:left"><code>layout</code></td><td style="text-align:left">布局</td><td style="text-align:left"><a target="_blank" rel="noopener external nofollow noreferrer" href="https://hexo.io/zh-cn/docs/configuration#%E6%96%87%E7%AB%A0"><code>config.default_layout</code></a></td></tr><tr><td style="text-align:left"><code>title</code></td><td style="text-align:left">标题</td><td style="text-align:left">文章的文件名</td></tr><tr><td style="text-align:left"><code>date</code></td><td style="text-align:left">建立日期</td><td style="text-align:left">文件建立日期</td></tr><tr><td style="text-align:left"><code>updated</code></td><td style="text-align:left">更新日期</td><td style="text-align:left">文件更新日期</td></tr><tr><td style="text-align:left"><code>comments</code></td><td style="text-align:left">开启文章的评论功能</td><td style="text-align:left">true</td></tr><tr><td style="text-align:left"><code>tags</code></td><td style="text-align:left">标签（不适用于分页）</td><td style="text-align:left"></td></tr><tr><td style="text-align:left"><code>categories</code></td><td style="text-align:left">分类（不适用于分页）</td><td style="text-align:left"></td></tr></tbody></table><h4 id="分类和标签"><a class="header-anchor" href="#分类和标签">☀</a>分类和标签</h4><p>只有文章支持分类和标签，您可以在 Front-matter 中设置。在其他系统中，分类和标签听起来很接近，但是在 Hexo 中两者有着明显的差别：分类具有顺序性和层次性，也就是说 <code>Foo, Bar</code> 不等于 <code>Bar, Foo</code>；而标签没有顺序和层次。</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">categories:</span></span><br><span class="line"><span class="bullet">-</span> <span class="string">Diary</span></span><br><span class="line"><span class="attr">tags:</span></span><br><span class="line"><span class="bullet">-</span> <span class="string">PS3</span></span><br><span class="line"><span class="bullet">-</span> <span class="string">Games</span></span><br></pre></td></tr></table></figure><blockquote><p>分类方法的分歧</p><p>如果您有过使用 WordPress 的经验，就很容易误解 Hexo 的分类方式。WordPress 支持对一篇文章设置多个分类，而且这些分类可以是同级的，也可以是父子分类。但是 Hexo 不支持指定多个同级分类。下面的指定方法：</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">categories:</span></span><br><span class="line">  <span class="bullet">-</span> <span class="string">Diary</span></span><br><span class="line">  <span class="bullet">-</span> <span class="string">Life</span></span><br></pre></td></tr></table></figure><p>会使分类<code>Life</code>成为<code>Diary</code>的子分类，而不是并列分类。因此，有必要为您的文章选择尽可能准确的分类。</p><p>如果你需要为文章添加多个分类，可以尝试以下 list 中的方法。</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">categories:</span></span><br><span class="line"><span class="bullet">-</span> [<span class="string">Diary</span>, <span class="string">PlayStation</span>]</span><br><span class="line"><span class="bullet">-</span> [<span class="string">Diary</span>, <span class="string">Games</span>]</span><br><span class="line"><span class="bullet">-</span> [<span class="string">Life</span>]</span><br></pre></td></tr></table></figure><p>此时这篇文章同时包括三个分类： <code>PlayStation</code> 和 <code>Games</code> 分别都是父分类 <code>Diary</code> 的子分类，同时 <code>Life</code> 是一个没有子分类的分类。</p></blockquote><h4 id="引入资源文件"><a class="header-anchor" href="#引入资源文件">☀</a>引入资源文件</h4><p>资源（Asset）代表 <code>source</code> 文件夹中除了文章以外的所有文件，例如图片、CSS、JS 文件等。比方说，如果你的Hexo项目中只有少量图片，那最简单的方法就是将它们放在 <code>source/images</code> 文件夹中。然后通过类似于 <code>![](/images/image.jpg)</code> 的方法访问它们。</p><p><strong>♣注：引入图片资源最好的解决方案就是使用图床。下方的方案可以参考，更加了解Hexo。</strong></p><p>对于那些想要更有规律地提供图片和其他资源以及想要将他们的资源分布在各个文章上的人来说，Hexo也提供了更组织化的方式来管理资源。这个稍微有些复杂但是管理资源非常方便的功能可以通过将 <code>config.yml</code> 文件中的 <code>post_asset_folder</code> 选项设为 <code>true</code> 来打开。</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">post_asset_folder:</span> <span class="literal">true</span></span><br></pre></td></tr></table></figure><p>当资源文件管理功能打开后，Hexo将会在你每一次通过 <code>hexo new [layout] &lt;title&gt;</code> 命令创建新文章时自动创建一个文件夹。<strong>这个资源文件夹将会有与这个文章文件一样的名字。<strong>将所有与你的文章有关的资源放在这个关联文件夹中之后，你可以通过</strong>相对路径</strong>来引用它们，这样你就得到了一个更简单而且方便得多的工作流。</p><p>由于md文件最终渲染后生成的index.html，最终会放到md文件名称的文件夹中。所以md中引入路径需要写成：<code>![](example.jpg)</code></p><p>但是这样写，如果文章显示在首页，则图片在首页中不会显示出。</p><p><strong>解决方案：</strong></p><p>​ ❀使用标签插件<br> ​</p><p>​ ❀使用Hexo3.1.0新增的插件渲染配置.</p><p>_config.yml</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">post_asset_folder:</span> <span class="literal">true</span></span><br><span class="line"><span class="attr">marked:</span></span><br><span class="line">  <span class="attr">prependRoot:</span> <span class="literal">true</span></span><br><span class="line">  <span class="attr">postAsset:</span> <span class="literal">true</span></span><br></pre></td></tr></table></figure><h4 id="引入数据文件"><a class="header-anchor" href="#引入数据文件">☀</a>引入数据文件</h4><p>有时您可能需要在主题中使用某些资料，而这些资料并不在文章内，并且是需要重复使用的，那么您可以考虑使用 Hexo 3.0 新增的「数据文件」功能。此功能会载入 <code>source/_data</code> 内的 YAML 或 JSON 文件，如此一来您便能在网站中复用这些文件了。</p><p>举例来说，在 <code>source/_data</code> 文件夹中新建 <code>menu.yml</code> 文件：</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">Home:</span> <span class="string">/</span></span><br><span class="line"><span class="attr">Gallery:</span> <span class="string">/gallery/</span></span><br><span class="line"><span class="attr">Archives:</span> <span class="string">/archives/</span></span><br></pre></td></tr></table></figure><p>您就能在模板中使用这些资料：</p><figure class="highlight jsp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">&lt;% <span class="keyword">for</span> (<span class="keyword">var</span> link in site.data.menu) &#123; %&gt;</span><br><span class="line">  &lt;a href=<span class="string">&quot;&lt;%= site.data.menu[link] %&gt;&quot;</span>&gt; &lt;%= link %&gt; &lt;/a&gt;</span><br><span class="line">&lt;% &#125; %&gt;</span><br></pre></td></tr></table></figure><p>渲染结果如下 :</p><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">a</span> <span class="attr">href</span>=<span class="string">&quot;/&quot;</span>&gt;</span> Home <span class="tag">&lt;/<span class="name">a</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">a</span> <span class="attr">href</span>=<span class="string">&quot;/gallery/&quot;</span>&gt;</span> Gallery <span class="tag">&lt;/<span class="name">a</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">a</span> <span class="attr">href</span>=<span class="string">&quot;/archives/&quot;</span>&gt;</span> Archives <span class="tag">&lt;/<span class="name">a</span>&gt;</span></span><br></pre></td></tr></table></figure><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/img/cover/animal/20210101205747.jpeg" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/img/cover/animal/20210101205747.jpeg" srcset="" alt=""></p><h3 id="部署"><a class="header-anchor" href="#部署">☀</a>部署</h3><p>Hexo 提供了快速方便的一键部署功能，让您只需一条命令就能将网站部署到服务器上。</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">$</span> <span class="string">hexo</span> <span class="string">deploy</span></span><br></pre></td></tr></table></figure><p>在开始之前，您必须先在 <code>_config.yml</code> 中修改参数，一个正确的部署配置中至少要有 <code>type</code> 参数.<br> 例如：使用git工具部署</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">deploy:</span></span><br><span class="line">  <span class="attr">type:</span> <span class="string">git</span></span><br></pre></td></tr></table></figure><p>可以使用支持多个平台同时部署</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">deploy:</span></span><br><span class="line">  <span class="attr">type:</span> <span class="string">&#x27;git&#x27;</span></span><br><span class="line">  <span class="attr">repo:</span></span><br><span class="line">    <span class="attr">github:</span></span><br><span class="line">      <span class="attr">url:</span></span><br><span class="line">      <span class="attr">branch:</span> <span class="string">gh-pages</span></span><br><span class="line">      <span class="attr">token:</span> <span class="string">$HEXO_GITHUB_TOKEN</span></span><br><span class="line">    <span class="attr">coding:</span></span><br><span class="line">      <span class="attr">url:</span></span><br><span class="line">      <span class="attr">branch:</span> <span class="string">gh-pages</span></span><br><span class="line">      <span class="attr">token:</span> <span class="string">$HEXO_CODING_TOKEN</span></span><br><span class="line"></span><br></pre></td></tr></table></figure><p>您可同时使用多个 deployer工具，Hexo 会依照顺序执行每个 deployer。</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">deploy:</span></span><br><span class="line"><span class="bullet">-</span> <span class="attr">type:</span> <span class="string">git</span></span><br><span class="line">  <span class="attr">repo:</span></span><br><span class="line"><span class="bullet">-</span> <span class="attr">type:</span> <span class="string">heroku</span></span><br><span class="line">  <span class="attr">repo:</span></span><br></pre></td></tr></table></figure><h4 id="Git工具部署"><a class="header-anchor" href="#Git工具部署">☀</a>Git工具部署</h4><ol><li>安装 <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/hexojs/hexo-deployer-git">hexo-deployer-git</a>。</li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ npm install hexo-deployer-git --save</span><br></pre></td></tr></table></figure><ol><li>修改配置。</li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">deploy:</span><br><span class="line">  type: git</span><br><span class="line">  repo: &lt;repository url&gt; #https://bitbucket.org/JohnSmith/johnsmith.bitbucket.io</span><br><span class="line">  branch: [branch]</span><br><span class="line">  message: [message]</span><br><span class="line">  token: [token]  #一般配置在环境变量中。</span><br></pre></td></tr></table></figure><table><thead><tr><th style="text-align:left">参数</th><th style="text-align:left">描述</th><th style="text-align:left">默认</th></tr></thead><tbody><tr><td style="text-align:left"><code>repo</code></td><td style="text-align:left">库（Repository）地址</td><td style="text-align:left"></td></tr><tr><td style="text-align:left"><code>branch</code></td><td style="text-align:left">分支名称</td><td style="text-align:left"><code>gh-pages</code> (GitHub) <code>coding-pages</code> (<a target="_blank" rel="noopener external nofollow noreferrer" href="http://Coding.net">Coding.net</a>) <code>master</code> (others)</td></tr><tr><td style="text-align:left"><code>message</code></td><td style="text-align:left">自定义提交信息</td><td style="text-align:left"><code>Site updated: &#123;&#123; now('YYYY-MM-DD HH:mm:ss') &#125;&#125;</code>)</td></tr><tr><td style="text-align:left"><code>token</code></td><td style="text-align:left">Optional token value to authenticate with the repo. Prefix with <code>$</code> to read token from environment variable</td><td style="text-align:left"></td></tr></tbody></table><ol><li><p>生成站点文件并推送至远程库。执行</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">hexo</span> <span class="string">clean</span> <span class="string">&amp;&amp;</span> <span class="string">hexo</span> <span class="string">deploy</span></span><br></pre></td></tr></table></figure><ul><li>You will be prompted with username and password of the target repository, unless you authenticate with a token or ssh key.</li><li>hexo-deployer-git does not store your username and password. Use <a target="_blank" rel="noopener external nofollow noreferrer" href="https://git-scm.com/docs/git-credential-cache">git-credential-cache</a> to store them temporarily.</li></ul></li><li><p>登入 Github/BitBucket/Gitlab，请在库设置（Repository Settings）中将默认分支设置为<code>_config.yml</code>配置中的分支名称。稍等片刻，您的站点就会显示在您的Github Pages中。</p></li></ol><p><strong>这一切是如何发生的？</strong></p><p>当执行 <code>hexo deploy</code> 时，Hexo 会将 <code>public</code> 目录中的文件和目录推送至 <code>_config.yml</code> 中指定的远端仓库和分支中，并且<strong>完全覆盖</strong>该分支下的已有内容。</p><h4 id="自动化部署"><a class="header-anchor" href="#自动化部署">☀</a>自动化部署</h4><h5 id="Travis-CI"><a class="header-anchor" href="#Travis-CI">☀</a>[Travis CI]</h5><h6 id="介绍"><a class="header-anchor" href="#介绍">☀</a>介绍</h6><blockquote><p>编写代码只是软件开发的一小部分，更多的时间往往花在构建（build）和测试（test）。</p><p>为了提高软件开发的效率，构建和测试的自动化工具层出不穷。Travis CI 就是这类工具之中，市场份额最大的一个。</p><p>用好这个工具不仅可以提高效率，还能使开发流程更可靠和专业化，从而提高软件的价值。而且，它对于开源项目是免费的，不花一分钱，就能帮你做掉很多事情。</p><p>什么是持续集成？<br> Travis CI 提供的是持续集成服务（Continuous Integration，简称 CI）。它绑定 Github 上面的项目，只要有新的代码，就会自动抓取。然后，提供一个运行环境，执行测试，完成构建，还能部署到服务器。</p><p>持续集成指的是只要代码有变更，就自动运行构建和测试，反馈运行结果。确保符合预期以后，再将新代码&quot;集成&quot;到主干。</p><p>持续集成的好处在于，每次代码的小幅变更，就能看到运行结果，从而不断累积小的变更，而不是在开发周期结束时，一下子合并一大块代码。</p></blockquote><h6 id="部署步骤"><a class="header-anchor" href="#部署步骤">☀</a>部署步骤</h6><ol><li>创建博客源码仓库和静态文件仓库。</li><li>github创建token，权限为repo。</li><li>前往 <a target="_blank" rel="noopener external nofollow noreferrer" href="https://travis-ci.com/">Travis CI</a> 使用 GitHub 账户登录并赋权。</li><li>Travis CI中前往你的 <strong>博客源码仓库</strong>repository 的设置页面，在 <strong>Environment Variables</strong> 下新建一个环境变量，<strong>Name</strong> 为 <code>GITHUB_TOKEN</code>，<strong>Value</strong> 为刚才你在 GitHub 生成的 Token。确保 <strong>DISPLAY VALUE IN BUILD LOG</strong> 保持 <strong>不被勾选</strong> 避免你的 Token 泄漏。点击 <strong>Add</strong> 保存。</li><li>在你的 Hexo 站点文件夹中新建一个 <code>.travis.yml</code> 文件：<a target="_blank" rel="noopener external nofollow noreferrer" href="https://gist.github.com/aner1001/d39bd021e59c047ee9bad847fd78fd7c">gistLink</a>.</li><li>接下来每次提交博客源码仓库，都会被Travis CI监控到。执行脚本，部署到静态文件仓库中。</li></ol><h5 id="GitHub-Actions"><a class="header-anchor" href="#GitHub-Actions">☀</a>[GitHub Actions]</h5><h6 id="介绍-2"><a class="header-anchor" href="#介绍-2">☀</a>介绍</h6><blockquote><p>大家知道，持续集成由很多操作组成，比如抓取代码、运行测试、登录远程服务器，发布到第三方服务等等。GitHub 把这些操作就称为 actions。</p><p>很多操作在不同项目里面是类似的，完全可以共享。GitHub 注意到了这一点，想出了一个很妙的点子，允许开发者把每个操作写成独立的脚本文件，存放到代码仓库，使得其他开发者可以引用。</p><p>如果你需要某个 action，不必自己写复杂的脚本，直接引用他人写好的 action 即可，整个持续集成过程，就变成了一个 actions 的组合。这就是 GitHub Actions 最特别的地方。</p><p>GitHub 做了一个<a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/marketplace?type=actions">官方市场</a>，可以搜索到他人提交的 actions。另外，还有一个 <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/sdras/awesome-actions">awesome actions</a> 的仓库，也可以找到不少 action。</p></blockquote><h6 id="部署步骤-2"><a class="header-anchor" href="#部署步骤-2">☀</a>部署步骤</h6><ol><li>创建博客源码仓库和静态文件仓库。</li><li>github创建token，权限为repo。</li><li>在博客源码仓库中创建隐私资料,settings-&gt;secrets,将创建的token存入。不等同于Travis中的配置。区别：secrets中的变量需要在脚本配置中再引入。Travis中配置的，直接就是环境变量直接可以使用。</li><li>在博客源码仓库中创建Actions，并配置。<a target="_blank" rel="noopener external nofollow noreferrer" href="https://gist.github.com/aner1001/664d32b2dcd4ecd64df1309e85f1bb0b#file-master-yml">参考Gist</a>。实际生成.github/workflow/xxx.yml配置文件。</li><li>每次提交博客源码仓库，都会被Actions监控，执行部署脚本。</li></ol><h2 id="好看的博客收藏"><a class="header-anchor" href="#好看的博客收藏">☀</a>好看的博客收藏</h2><table><thead><tr><th>博客地址</th><th>亮点</th></tr></thead><tbody><tr><td><a target="_blank" rel="noopener external nofollow noreferrer" href="https://eightplus.github.io/">https://eightplus.github.io/</a></td><td>嵌入音乐。侧边栏支持隐藏/打开。支持站内搜索。</td></tr><tr><td><a target="_blank" rel="noopener external nofollow noreferrer" href="https://mellow.yuanlichenai.cn/">https://mellow.yuanlichenai.cn/</a></td><td>有一个可以盯着得玩具人，逗她玩。</td></tr><tr><td><a target="_blank" rel="noopener external nofollow noreferrer" href="http://litten.me/">http://litten.me/</a></td><td>相册功能很不错。</td></tr><tr><td><a target="_blank" rel="noopener external nofollow noreferrer" href="https://www.codesheep.cn/">https://www.codesheep.cn/</a></td><td>标签云很好看。有专题文章。搜索功能好，可以搜索到书签，分类。</td></tr><tr><td><a target="_blank" rel="noopener external nofollow noreferrer" href="https://jerryc.me/">https://jerryc.me/</a></td><td>归档时间轴好看，设置简体繁体，全屏，黑夜模式。电影和照片也是亮点。标签侧边显示。手机端查看也支持目录。</td></tr><tr><td><a target="_blank" rel="noopener external nofollow noreferrer" href="https://blog.cofess.com/">https://blog.cofess.com/</a></td><td>搜索功能好，可以搜索到书签，分类。</td></tr><tr><td><a target="_blank" rel="noopener external nofollow noreferrer" href="https://molunerfinn.com/archives/">https://molunerfinn.com/archives/</a></td><td>简洁美观。</td></tr><tr><td><a target="_blank" rel="noopener external nofollow noreferrer" href="https://volantis.js.org/">https://volantis.js.org/</a></td><td>本人就是最终选择了这个，太好用了，简洁美观，文档说明清晰，优化也很好。Volantis！</td></tr></tbody></table><h2 id="Volantis主题"><a class="header-anchor" href="#Volantis主题">☀</a>Volantis主题</h2><p>注意：</p><p>使用hexo-filter-github-emojis 插件会使gulp压缩报错，不能用这个插件。</p><p>使用emojis插件个人推荐：markdown-it-emoji，好看简洁又好用。重点和Typroa渲染一模一样。</p><h2 id="问题解决"><a class="header-anchor" href="#问题解决">☀</a>问题解决</h2><h3 id="1-YAMLException-can-not-read-a-block-mapping-entry-a-multiline-key-may-not-be-an-implicit-key-at-…"><a class="header-anchor" href="#1-YAMLException-can-not-read-a-block-mapping-entry-a-multiline-key-may-not-be-an-implicit-key-at-…">☀</a>1.YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key at …</h3><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2020/12/19/20201220115101.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2020/12/19/20201220115101.png" srcset="" alt="image-20201220115100448"></p><p>原因是在博客头文件时，键值对格式需要有空格。</p><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2020/12/20/20201220115235.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2020/12/20/20201220115235.png" srcset="" alt="image-20201220115235285"></p><h3 id="2-ExperimentalWarning-The-fs-promises-API-is-experimental"><a class="header-anchor" href="#2-ExperimentalWarning-The-fs-promises-API-is-experimental">☀</a>2.ExperimentalWarning: The fs.promises API is experimental</h3><p>根本原因是node的版本不是最新的，而在项目引入的模块是最新的，node.js的版本低于模块的版本：</p><p>解决方法是升级npm,node.js：</p><h3 id="3-Warning-Accessing-non-existent-property-‘lineno’-of-module-exports-inside-circular-dependency"><a class="header-anchor" href="#3-Warning-Accessing-non-existent-property-‘lineno’-of-module-exports-inside-circular-dependency">☀</a>3.Warning: Accessing non-existent property ‘lineno’ of module exports inside circular dependency</h3><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2020/12/28/20201228092410.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2020/12/28/20201228092410.png" srcset="" alt="image-20201228092407958"></p><p>出现这些是因为node版本太高，切换成低版本的node来安装Hexo就可以了</p><h3 id="4-Travis-CI日志push失败src-refspec-master-does-not-match-any"><a class="header-anchor" href="#4-Travis-CI日志push失败src-refspec-master-does-not-match-any">☀</a>4.Travis CI日志push失败src refspec master does not match any</h3><p>原因：tarvis ci配置文件中，commit的说明中带有中文，导致TravisCI环境中中文变为空字符串。提交报错，最终导致无法提交远程仓库。</p><p>配置文件中带有中文：<img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2020/12/28/20201228155633.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2020/12/28/20201228155633.png" srcset="" alt="image-20201228155633485"></p><p>TravisCi环境中提交时，变为了空字符串，提交失败。<br> 日志报文信息:<br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2020/12/28/20201228155543.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2020/12/28/20201228155543.png" srcset="" alt="image-20201228155536552"></p><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2020/12/28/20201228155611.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2020/12/28/20201228155611.png" srcset="" alt="image-20201228155611409"></p><h3 id="5-extends-includes-layout-pug-block-content-include-includes-mixins-post-ui-pug-recent-posts-recent-posts-postUI-include-includes-pagination-pug"><a class="header-anchor" href="#5-extends-includes-layout-pug-block-content-include-includes-mixins-post-ui-pug-recent-posts-recent-posts-postUI-include-includes-pagination-pug">☀</a>5.extends includes/layout.pug block content include ./includes/mixins/post-ui.pug #recent-posts.recent-posts +postUI include includes/pagination.pug</h3><p>解决执行：</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install --save hexo-renderer-jade hexo-generator-feed hexo-generator-sitemap hexo-browsersync hexo-generator-archive</span><br></pre></td></tr></table></figure><p><code>hexo clean</code></p><p><code>hexo g</code></p><p><code>hexo s</code></p><h3 id="6-err-Error-Nunjucks-Error-gallery-index-md-Line-2-Column-4-unknown-block-tag-galleryGroup"><a class="header-anchor" href="#6-err-Error-Nunjucks-Error-gallery-index-md-Line-2-Column-4-unknown-block-tag-galleryGroup">☀</a>6.err: Error [Nunjucks Error]: gallery/index.md [Line 2, Column 4] unknown block tag: galleryGroup</h3><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/01/13/20210113105157.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/01/13/20210113105157.png" srcset="" alt="image-20210113105132673"></p><h3 id="7-Git提交时提示‘The-file-will-have-its-original-line-endings-in-your-working-directory’"><a class="header-anchor" href="#7-Git提交时提示‘The-file-will-have-its-original-line-endings-in-your-working-directory’">☀</a>7.<a target="_blank" rel="noopener external nofollow noreferrer" href="https://www.cnblogs.com/lovebing/p/7121754.html">Git提交时提示‘The file will have its original line endings in your working directory’</a></h3><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/01/13/image-20210113220223509.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/01/13/image-20210113220223509.png" srcset="" alt="image-20210113220223509"></p><blockquote><p>原来是Git默认配置替换回车换行成统一的CRLF，我们只需要修改配置禁用该功能即可。</p><p>Gitshell中输入如下命令解决：</p><p>git config --global core.autocrlf false</p></blockquote><h3 id="8-PWA启动err-TypeError-Cannot-read-property-‘data’-of-undefined"><a class="header-anchor" href="#8-PWA启动err-TypeError-Cannot-read-property-‘data’-of-undefined">☀</a>8.PWA启动err: TypeError: Cannot read property ‘data’ of undefined</h3><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/img/gif/image-20210119204006668.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/img/gif/image-20210119204006668.png" srcset="" alt="image-20210119204006668"></p><p>原因是hexo版本过高导致。</p><h3 id="9-heox部署Warning-Accessing-non-existent-property-‘column’-of-module"><a class="header-anchor" href="#9-heox部署Warning-Accessing-non-existent-property-‘column’-of-module">☀</a>9. heox部署Warning: Accessing non-existent property ‘column’ of module</h3><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/01/25/image-20210125092307162.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/01/25/image-20210125092307162.png" srcset="" alt="image-20210125092307162"></p><blockquote><p>出现这些是因为node版本太高，切换成低版本的node来安装Hexo就可以了</p><p>我原先是安装了最新版node14.0，后来多装了一个比较稳定的node12.14版本，这个问题就解决了</p></blockquote><h3 id="10-cnpm安装过程中提示optional-install-error-Package-require-os-darwin-not-compatible-with-your-platform"><a class="header-anchor" href="#10-cnpm安装过程中提示optional-install-error-Package-require-os-darwin-not-compatible-with-your-platform">☀</a>10.cnpm安装过程中提示optional install error: Package require os(darwin) not compatible with your platform</h3><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/img/cover/fav/image-20210127094327003.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/img/cover/fav/image-20210127094327003.png" srcset="" alt="image-20210127094327003"></p><p>sass loader出问题的</p><p>解决方法：<code>cnpm rebuild node-sass</code> —经过尝试不一定行。😢</p><p>😄</p><h3 id="11-刚下载下来的Hexo工程，hexo-g报错，无法编译。unknown-block-tag-btn"><a class="header-anchor" href="#11-刚下载下来的Hexo工程，hexo-g报错，无法编译。unknown-block-tag-btn">☀</a>11.刚下载下来的Hexo工程，hexo g报错，无法编译。unknown block tag: btn</h3><p><img src="https://i.loli.net/2021/07/31/C41BEzjt5TLI7YO.png" class="lazyload" data-srcset="https://i.loli.net/2021/07/31/C41BEzjt5TLI7YO.png" srcset="" alt=""></p><p>原因是:子工程主题模块没有下载。</p><p>解决办法：</p><p>1.<code>git submodule update --init --recursive</code> 下载子工程</p><p>2.<code>git clone 父工程地址 --recursive</code> #在克隆父工程时，直接使用递归命令</p><h2 id="参考文献"><a class="header-anchor" href="#参考文献">☀</a>参考文献</h2><iframe src="//player.bilibili.com/player.html?aid=44544186&bvid=BV1Yb411a7ty&cid=158772893&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" height="500" width="100%"></iframe><p><a target="_blank" rel="noopener external nofollow noreferrer" href="https://www.cnblogs.com/abab/articles/10779736.html">nodejs环境搭建之搭建nvm(node版本管理)</a></p><p><a target="_blank" rel="noopener external nofollow noreferrer" href="https://blog.csdn.net/muzidigbig/article/details/80493880?ops_request_misc=%25257B%252522request%25255Fid%252522%25253A%252522160834115616780308375658%252522%25252C%252522scm%252522%25253A%25252220140713.130102334..%252522%25257D&amp;request_id=160834115616780308375658&amp;biz_id=0&amp;utm_medium=distribute.pc_search_result.none-task-blog-2~all~baidu_landing_v2~default-8-80493880.nonecase&amp;utm_term=nodejs">NodeJS入门（一）—nodejs详细安装步骤</a></p><p><a target="_blank" rel="noopener external nofollow noreferrer" href="https://blog.csdn.net/weixin_41350225/article/details/88253726?ops_request_misc=%25257B%252522request%25255Fid%252522%25253A%252522160837258416780310150944%252522%25252C%252522scm%252522%25253A%25252220140713.130102334..%252522%25257D&amp;request_id=160837258416780310150944&amp;biz_id=0&amp;utm_medium=distribute.pc_search_result.none-task-blog-2~all~top_click~default-4-88253726.nonecase&amp;utm_term=npm">npm基本命令</a></p><p><a target="_blank" rel="noopener external nofollow noreferrer" href="https://www.cnblogs.com/qiangxia/p/5264720.html">npm install 本地安装与全局安装的区别</a></p><p><a target="_blank" rel="noopener external nofollow noreferrer" href="https://www.jianshu.com/p/cb9895714f3b">YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key at …</a></p><p><a target="_blank" rel="noopener external nofollow noreferrer" href="https://blog.csdn.net/pange1991/article/details/88591837">npm install 、npm install --save 和 npm install --save-dev的区别</a></p><p><a target="_blank" rel="noopener external nofollow noreferrer" href="https://www.bilibili.com/read/cv2884489">[馨客栈分享]使用travis CI自动部署hexo博客到Github并且在Github pages上展示页面</a></p><p><a target="_blank" rel="noopener external nofollow noreferrer" href="https://jerryc.me/posts/74006f42/">通过travis-ci或者GitHub Actions自动化部署GitHub Pages和Coding Pages</a></p><p><a target="_blank" rel="noopener external nofollow noreferrer" href="http://www.ruanyifeng.com/blog/2017/12/travis_ci_tutorial.html">持续集成服务 Travis CI 教程</a></p><p><a target="_blank" rel="noopener external nofollow noreferrer" href="http://www.ruanyifeng.com/blog/2019/09/getting-started-with-github-actions.html">GitHub Actions 入门教程</a></p><div class="footer"><div class="copyright"><blockquote><p>博客内容遵循 署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0) 协议</p><p>本文永久链接是：<a href="http://aner1001.gitee.io/posts/2021/06/05/fe58c35af835/">http://aner1001.gitee.io/posts/2021/06/05/fe58c35af835/</a></p></blockquote></div></div><div class="article-meta" id="bottom"><div class="new-meta-box"><div class="new-meta-item date" itemprop="dateUpdated" datetime="2021-06-05T15:11:56+08:00"><a class="notlink"><i class="fas fa-edit fa-fw" aria-hidden="true"></i><p>更新于：2021年6月5日</p></a></div><div class="new-meta-item meta-tags"><a class="tag" href="/tags/Hexo/" rel="nofollow"><i class="fas fa-hashtag fa-fw" aria-hidden="true"></i><p>Hexo</p></a></div><div class="new-meta-item meta-tags"><a class="tag" href="/tags/Nodejs/" rel="nofollow"><i class="fas fa-hashtag fa-fw" aria-hidden="true"></i><p>Nodejs</p></a></div><div class="new-meta-item share -mob-share-list"><div class="-mob-share-list share-body"> <a class="-mob-share-qq" title="" rel="external nofollow noopener noreferrer noopener" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://aner1001.gitee.io/posts/2021/06/05/fe58c35af835/&title=Hexo搭建个人博客 - Tang's blog.&summary=本人的博客最终选择了Hexo，原因：

强大的社区，基本什么问题都能查到，网上各种主题模板资料很全，各种QQ群一起high，讨论。
插件功能强大，技术成熟，使用起来很方便，从而封装性很好。
也能使用自动化部署技术GitHubActions或者TravisCi技术,弥补了相对于Jekyll博客能在Github自动部署的缺点。
使用Hexo能让你学习到很多东西。例如git知识、自动化部署等、第三方工具、在线编辑、云等等。"><img src="https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/qq.png" class="lazyload" data-srcset="https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/qq.png" srcset=""></a> <a class="-mob-share-qzone" title="" rel="external nofollow noopener noreferrer noopener" target="_blank" href="https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=http://aner1001.gitee.io/posts/2021/06/05/fe58c35af835/&title=Hexo搭建个人博客 - Tang's blog.&summary=本人的博客最终选择了Hexo，原因：

强大的社区，基本什么问题都能查到，网上各种主题模板资料很全，各种QQ群一起high，讨论。
插件功能强大，技术成熟，使用起来很方便，从而封装性很好。
也能使用自动化部署技术GitHubActions或者TravisCi技术,弥补了相对于Jekyll博客能在Github自动部署的缺点。
使用Hexo能让你学习到很多东西。例如git知识、自动化部署等、第三方工具、在线编辑、云等等。"><img src="https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/qzone.png" class="lazyload" data-srcset="https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/qzone.png" srcset=""></a> <a class="-mob-share-weibo" title="" rel="external nofollow noopener noreferrer noopener" target="_blank" href="http://service.weibo.com/share/share.php?url=http://aner1001.gitee.io/posts/2021/06/05/fe58c35af835/&title=Hexo搭建个人博客 - Tang's blog.&summary=本人的博客最终选择了Hexo，原因：

强大的社区，基本什么问题都能查到，网上各种主题模板资料很全，各种QQ群一起high，讨论。
插件功能强大，技术成熟，使用起来很方便，从而封装性很好。
也能使用自动化部署技术GitHubActions或者TravisCi技术,弥补了相对于Jekyll博客能在Github自动部署的缺点。
使用Hexo能让你学习到很多东西。例如git知识、自动化部署等、第三方工具、在线编辑、云等等。"><img src="https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/weibo.png" class="lazyload" data-srcset="https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/weibo.png" srcset=""></a><div class="hoverbox"> <a class="share"><img src="https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/wechat.png" class="lazyload" data-srcset="https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/wechat.png" srcset=""></a><div class="target"> <img src=""></div></div> <a class="-mob-share-telegram" title="" rel="external nofollow noopener noreferrer noopener" target="_blank" href="https://t.me/share/url?url=http://aner1001.gitee.io/posts/2021/06/05/fe58c35af835/&text=Hexo搭建个人博客 - Tang's blog."><img src="https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/telegram.png" class="lazyload" data-srcset="https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/telegram.png" srcset=""></a></div></div></div></div><div class="prev-next"><a class="prev" href="/posts/2021/07/09/ce7f3937fcde/"><p class="title"><i class="fas fa-chevron-left" aria-hidden="true"></i>Protostuff与Jedis工具类</p><p class="content">Redis有很多数据结构：string、hash、list、set等，但是在实际来发中，我们往往保存的是对象在redis中，所以键值对更加常用。 Redis在保存对象时，需要满足序列化，由于...</p></a><a class="next" href="/posts/2021/05/29/a4740947d4f3/"><p class="title">Ruby环境搭建篇(Jekyll博客)<i class="fas fa-chevron-right" aria-hidden="true"></i></p><p class="content">Jekyll博客基于Ruby开发，需要安装Ruby开发和运行环境。 本篇介绍Ruby和Ruby环境搭建。 ☀Ruby ☀Ruby 简介 Ruby是一种纯粹的面向对象编程语言。它由日本的松本行...</p></a></div></article><article class="post white-box reveal shadow" id="comments"><p ct><i class="fas fa-comments"></i> 评论</p><div id="valine_container" class="valine_thread"><i class="fas fa-cog fa-spin fa-fw fa-2x"></i></div></article></div><aside class="l_side"><section class="widget toc-wrapper shadow desktop mobile" id="toc-div"><header><i class="fas fa-list fa-fw" aria-hidden="true"></i> <span class="name">本文目录</span></header><div class="content"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#Hexo%E6%90%AD%E5%BB%BA%E5%8D%9A%E5%AE%A2-%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B"><span class="toc-text">Hexo搭建博客(快速上手)</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#hexo%E5%AE%89%E8%A3%85"><span class="toc-text">hexo安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E5%91%BD%E4%BB%A4%E6%9C%AC%E5%9C%B0%E5%88%9B%E5%BB%BA%E5%8D%9A%E5%AE%A2"><span class="toc-text">基本命令本地创建博客</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%B0%86%E5%8D%9A%E5%AE%A2%E9%83%A8%E7%BD%B2%E8%BF%9C%E7%AB%AF"><span class="toc-text">将博客部署远端</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%9B%B4%E6%8D%A2%E4%B8%BB%E9%A2%98"><span class="toc-text">更换主题</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%A0%B9%E7%9B%AE%E5%BD%95%E8%AE%BE%E7%BD%AE"><span class="toc-text">根目录设置</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Hexo%E9%85%8D%E7%BD%AE-config-yml"><span class="toc-text">Hexo配置_config.yml</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%8F%82%E6%95%B0%E7%BA%AA%E8%A6%81"><span class="toc-text">参数纪要</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#site%E7%BD%91%E7%AB%99%E5%8F%82%E6%95%B0"><span class="toc-text">#site网站参数</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#URL%E7%BD%91%E5%9D%80%E5%8F%82%E6%95%B0"><span class="toc-text">#URL网址参数</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#Directory%E7%9B%AE%E5%BD%95%E5%8F%82%E6%95%B0"><span class="toc-text">#Directory目录参数</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#Writing%E5%86%99%E4%BD%9C%E6%96%87%E7%AB%A0%E7%9A%84%E5%8F%82%E6%95%B0"><span class="toc-text">#Writing写作文章的参数</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#Date-Time-format%E6%97%A5%E6%9C%9F%E6%A0%BC%E5%BC%8F%E5%8F%82%E6%95%B0"><span class="toc-text">#Date &#x2F; Time format日期格式参数</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#Extensions-Plugins-Themes-Deployment%E4%B8%BB%E9%A2%98%EF%BC%8C%E6%8B%93%E5%B1%95%EF%BC%8C%E5%8F%91%E5%B8%83%E7%AD%89%E5%8F%82%E6%95%B0"><span class="toc-text">#Extensions&#x2F;Plugins&#x2F;Themes&#x2F;Deployment主题，拓展，发布等参数</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%8C%85%E6%8B%AC%E6%88%96%E4%B8%8D%E5%8C%85%E6%8B%AC%E7%9B%AE%E5%BD%95%E5%92%8C%E6%96%87%E4%BB%B6-Include-Exclude-file-s"><span class="toc-text">#包括或不包括目录和文件# Include &#x2F; Exclude file(s)</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%B0%B8%E4%B9%85%E9%93%BE%E6%8E%A5%EF%BC%88Permalinks%EF%BC%89"><span class="toc-text">#永久链接（Permalinks）</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%8F%98%E9%87%8F"><span class="toc-text">变量</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#%E5%A4%9A%E8%AF%AD%E7%A7%8D%E6%94%AF%E6%8C%81"><span class="toc-text">多语种支持</span></a></li></ol></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E5%90%88%E5%B9%B6%E5%8E%9F%E7%90%86"><span class="toc-text">配置文件合并原理</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8%E4%BB%A3%E6%9B%BF%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6"><span class="toc-text">使用代替配置文件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8%E4%BB%A3%E6%9B%BF%E4%B8%BB%E9%A2%98%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6"><span class="toc-text">使用代替主题配置文件</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Hexo%E5%91%BD%E4%BB%A4"><span class="toc-text">Hexo命令</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#init"><span class="toc-text">init</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#new"><span class="toc-text">new</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#generate"><span class="toc-text">generate</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#publish"><span class="toc-text">publish</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#server"><span class="toc-text">server</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#deploy"><span class="toc-text">deploy</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#render"><span class="toc-text">render</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#clean"><span class="toc-text">clean</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#list"><span class="toc-text">list</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#version"><span class="toc-text">version</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E7%9A%84%E6%93%8D%E4%BD%9C"><span class="toc-text">基本的操作</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E6%96%87%E7%AB%A0"><span class="toc-text">创建文章</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%B8%83%E5%B1%80%EF%BC%88Layout%EF%BC%89"><span class="toc-text">布局（Layout）</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A8%A1%E7%89%88%EF%BC%88Scaffold%EF%BC%89"><span class="toc-text">自定义模版（Scaffold）</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%96%87%E4%BB%B6%E5%90%8D%E7%A7%B0"><span class="toc-text">文件名称</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%86%99%E4%BD%9C"><span class="toc-text">写作</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%86%99%E4%BD%9C%E8%AF%AD%E8%A8%80%E6%A0%BC%E5%BC%8F"><span class="toc-text">写作语言格式</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#Front-matter%E6%96%87%E7%AB%A0%E5%89%8D%E6%8F%90"><span class="toc-text">Front-matter文章前提</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%88%86%E7%B1%BB%E5%92%8C%E6%A0%87%E7%AD%BE"><span class="toc-text">分类和标签</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%BC%95%E5%85%A5%E8%B5%84%E6%BA%90%E6%96%87%E4%BB%B6"><span class="toc-text">引入资源文件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%BC%95%E5%85%A5%E6%95%B0%E6%8D%AE%E6%96%87%E4%BB%B6"><span class="toc-text">引入数据文件</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%83%A8%E7%BD%B2"><span class="toc-text">部署</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#Git%E5%B7%A5%E5%85%B7%E9%83%A8%E7%BD%B2"><span class="toc-text">Git工具部署</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%87%AA%E5%8A%A8%E5%8C%96%E9%83%A8%E7%BD%B2"><span class="toc-text">自动化部署</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#Travis-CI"><span class="toc-text">[Travis CI]</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#GitHub-Actions"><span class="toc-text">[GitHub Actions]</span></a></li></ol></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%A5%BD%E7%9C%8B%E7%9A%84%E5%8D%9A%E5%AE%A2%E6%94%B6%E8%97%8F"><span class="toc-text">好看的博客收藏</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Volantis%E4%B8%BB%E9%A2%98"><span class="toc-text">Volantis主题</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3"><span class="toc-text">问题解决</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-YAMLException-can-not-read-a-block-mapping-entry-a-multiline-key-may-not-be-an-implicit-key-at-%E2%80%A6"><span class="toc-text">1.YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key at …</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-ExperimentalWarning-The-fs-promises-API-is-experimental"><span class="toc-text">2.ExperimentalWarning: The fs.promises API is experimental</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-Warning-Accessing-non-existent-property-%E2%80%98lineno%E2%80%99-of-module-exports-inside-circular-dependency"><span class="toc-text">3.Warning: Accessing non-existent property ‘lineno’ of module exports inside circular dependency</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-Travis-CI%E6%97%A5%E5%BF%97push%E5%A4%B1%E8%B4%A5src-refspec-master-does-not-match-any"><span class="toc-text">4.Travis CI日志push失败src refspec master does not match any</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#5-extends-includes-layout-pug-block-content-include-includes-mixins-post-ui-pug-recent-posts-recent-posts-postUI-include-includes-pagination-pug"><span class="toc-text">5.extends includes&#x2F;layout.pug block content include .&#x2F;includes&#x2F;mixins&#x2F;post-ui.pug #recent-posts.recent-posts +postUI include includes&#x2F;pagination.pug</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-err-Error-Nunjucks-Error-gallery-index-md-Line-2-Column-4-unknown-block-tag-galleryGroup"><span class="toc-text">6.err: Error [Nunjucks Error]: gallery&#x2F;index.md [Line 2, Column 4] unknown block tag: galleryGroup</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#7-Git%E6%8F%90%E4%BA%A4%E6%97%B6%E6%8F%90%E7%A4%BA%E2%80%98The-file-will-have-its-original-line-endings-in-your-working-directory%E2%80%99"><span class="toc-text">7.Git提交时提示‘The file will have its original line endings in your working directory’</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#8-PWA%E5%90%AF%E5%8A%A8err-TypeError-Cannot-read-property-%E2%80%98data%E2%80%99-of-undefined"><span class="toc-text">8.PWA启动err: TypeError: Cannot read property ‘data’ of undefined</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9-heox%E9%83%A8%E7%BD%B2Warning-Accessing-non-existent-property-%E2%80%98column%E2%80%99-of-module"><span class="toc-text">9. heox部署Warning: Accessing non-existent property ‘column’ of module</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#10-cnpm%E5%AE%89%E8%A3%85%E8%BF%87%E7%A8%8B%E4%B8%AD%E6%8F%90%E7%A4%BAoptional-install-error-Package-require-os-darwin-not-compatible-with-your-platform"><span class="toc-text">10.cnpm安装过程中提示optional install error: Package require os(darwin) not compatible with your platform</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#11-%E5%88%9A%E4%B8%8B%E8%BD%BD%E4%B8%8B%E6%9D%A5%E7%9A%84Hexo%E5%B7%A5%E7%A8%8B%EF%BC%8Chexo-g%E6%8A%A5%E9%94%99%EF%BC%8C%E6%97%A0%E6%B3%95%E7%BC%96%E8%AF%91%E3%80%82unknown-block-tag-btn"><span class="toc-text">11.刚下载下来的Hexo工程，hexo g报错，无法编译。unknown block tag: btn</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8F%82%E8%80%83%E6%96%87%E7%8C%AE"><span class="toc-text">参考文献</span></a></li></ol></div></section></aside><script>window.pdata={},pdata.ispage=!0,pdata.postTitle="Hexo搭建个人博客",pdata.commentPath="",pdata.commentPlaceholder="";var l_header=document.getElementById("l_header");l_header.classList.add("show");var cover_wrapper=document.querySelector(".cover-wrapper");cover_wrapper.id="none",cover_wrapper.style.display="none"</script></div><footer class="footer clearfix"><br><br><div class="aplayer-container"><meting-js theme="#1BCDFC" autoplay="false" volume="0.7" loop="all" order="list" fixed="false" list-max-height="320px" server="netease" type="playlist" id="5472211102" list-folded="true"></meting-js></div><br><div class="social-wrapper"><a href="/atom.xml" class="social fas fa-rss flat-btn" target="_blank" rel="external nofollow noopener noreferrer"></a><a href="mailto:584856024@qq.com" class="social fas fa-envelope flat-btn" target="_blank" rel="external nofollow noopener noreferrer"></a><a href="https://github.com/aner1001" class="social fab fa-github flat-btn" target="_blank" rel="external nofollow noopener noreferrer"></a><a href="https://music.163.com/#/user/home?id=1402271985" class="social fas fa-headphones-alt flat-btn" target="_blank" rel="external nofollow noopener noreferrer"></a></div><div><p>博客内容遵循 <a target="_blank" rel="noopener external nofollow noreferrer" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0) 协议</a></p></div><div><p><span id="lc-sv">本站总访问量为<span id="number"><i class="fas fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i></span> 次</span> <span id="lc-uv">访客数为<span id="number"><i class="fas fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i></span> 人</span></p></div> 本站使用 <a href="https://github.com/volantis-x/hexo-theme-volantis/tree/4.3.1" rel="external nofollow noreferrer" target="_blank" class="codename">Volantis</a> 作为主题，总访问量为<span id="busuanzi_value_site_pv"><i class="fas fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i></span> 次<div class="copyright"><p><a href="/">Copyright © 2021-2021 XXX</a></p></div></footer><a id="s-top" class="fas fa-arrow-up fa-fw" href="javascript:void(0)" rel="external nofollow noreferrer"></a></div></div><div><script>function VPjax(){function e(e,t){this.name=t||e.name,this.run=()=>{e()}}this.list=[],this.start=()=>{for(var e=0;e<this.list.length;e++)this.list[e].run()},this.push=(t,n)=>{var i=new e(t,n);this.list.push(i)}}function loadScript(e,t){setTimeout((function(){var n=document.getElementsByTagName("head")[0]||document.documentElement,i=document.createElement("script");i.setAttribute("type","text/javascript"),t&&(i.onload=t),i.setAttribute("src",e),n.appendChild(i)}))}window.volantis={},window.volantis.loadcss=document.getElementById("loadcss"),volantis.pjax={},volantis.pjax.method={complete:new VPjax,error:new VPjax,send:new VPjax},volantis.pjax={...volantis.pjax,push:volantis.pjax.method.complete.push,error:volantis.pjax.method.error.push,send:volantis.pjax.method.send.push};var loadCSS=function(e,t,n,i){var o,a=window.document,s=a.createElement("link");if(t)o=t;else{var r=(a.body||a.getElementsByTagName("head")[0]).childNodes;o=r[r.length-1]}var d=a.styleSheets;if(i)for(var l in i)i.hasOwnProperty(l)&&s.setAttribute(l,i[l]);s.rel="stylesheet",s.href=e,s.media="only x",function e(t){if(a.body)return t();setTimeout((function(){e(t)}))}((function(){o.parentNode.insertBefore(s,t?o:o.nextSibling)}));var u=function(e){for(var t=s.href,n=d.length;n--;)if(d[n].href===t)return e();setTimeout((function(){u(e)}))};function h(){s.addEventListener&&s.removeEventListener("load",h),s.media=n||"all"}return s.addEventListener&&s.addEventListener("load",h),s.onloadcssdefined=u,u(h),s}</script><script>loadCSS("https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.14/css/all.min.css",window.volantis.loadcss),loadCSS("https://cdn.jsdelivr.net/gh/l-lin/font-awesome-animation/dist/font-awesome-animation.min.css",window.volantis.loadcss),loadCSS("https://cdn.jsdelivr.net/npm/node-waves@0.7.6/dist/waves.min.css",window.volantis.loadcss)</script><script src="https://cdn.jsdelivr.net/npm/jquery@3.5/dist/jquery.min.js"></script><script>function pjax_fancybox(){$(".md .gallery").find("img").each((function(){var a=document.createElement("a");$(a).attr("class","fancybox"),$(a).attr("pjax-fancybox",""),$(a).attr("href",$(this).attr("src")),$(this).attr("data-original")&&$(a).attr("href",$(this).attr("data-original")),$(a).attr("data-fancybox","images");var t="";$(this).attr("alt")&&($(a).attr("data-caption",$(this).attr("alt")),t=$(this).attr("alt"));var n=document.createElement("div");$(n).addClass("fancybox"),$(this).wrap(n);var o=document.createElement("span");$(o).addClass("image-caption"),$(o).text(t),$(this).after(o),$(this).wrap(a)})),$(".md .gallery").find("img").fancybox({selector:'[data-fancybox="images"]',hash:!1,loop:!1,closeClick:!0,helpers:{overlay:{closeClick:!0}},buttons:["zoom","close"]})}function SCload_fancybox(){0!=$(".md .gallery").find("img").length&&(loadCSS("https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css",document.getElementById("loadcss")),loadScript("https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js",pjax_fancybox))}function Pjax_SCload_fancybox(){void 0===$.fancybox?SCload_fancybox():pjax_fancybox()}$((function(){SCload_fancybox()})),volantis.pjax.push(Pjax_SCload_fancybox),volantis.pjax.send(()=>{void 0!==$.fancybox&&$.fancybox.close()},"fancybox")</script><script src="https://cdn.jsdelivr.net/npm/jquery-backstretch@2.1.18/jquery.backstretch.min.js"></script><script type="text/javascript">var imgs=["https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/001.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/002.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/003.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/004.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/005.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/006.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/012.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/016.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/019.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/025.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/033.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/034.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/035.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/038.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/039.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/042.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/046.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/051.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/052.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/054.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/056.jpg"];{function shuffle(t){for(var n=t.length;n--;){var i=Math.floor(Math.random()*n),l=t[i];t[i]=t[n],t[n]=l}}shuffle(imgs)}function Pjax_backstretch(){$("#cover-backstretch").backstretch(imgs,{duration:"10000",fade:"1500"})}loadScript("https://cdn.jsdelivr.net/npm/jquery-backstretch@2.1.18/jquery.backstretch.min.js",Pjax_backstretch)</script><div id="rightmenu-wrapper"><ul class="list-v rightmenu" id="rightmenu-content"><li class="option"><a class="vlts-menu opt fix-cursor-default" id="menu-copy-text" onclick='document.execCommand("copy")'><i class="fa fa-copy fa-fw"></i> 复制文本</a><hr id="hr-text"><a class="vlts-menu opt fix-cursor-default" id="menu-copy-href"><i class="fa fa-link fa-fw"></i> 复制链接</a><a class="vlts-menu opt fix-cursor-default" id="menu-open-href"><i class="fa fa-external-link-square-alt fa-fw"></i> 在新标签页打开</a><hr id="hr-href"><a class="vlts-menu opt fix-cursor-default" id="menu-copy-src"><i class="fa fa-image fa-fw"></i> 复制图片地址</a><hr id="hr-src"></li><li class="navigation"><a class="nav icon-only fix-cursor-default" onclick="history.back()"><i class="fa fa-arrow-left fa-fw"></i></a><a class="nav icon-only fix-cursor-default" onclick="history.forward()"><i class="fa fa-arrow-right fa-fw"></i></a><a class="nav icon-only fix-cursor-default" onclick="window.location.reload()"><i class="fa fa-redo fa-fw"></i></a><a class="nav icon-only fix-cursor-default" href="/"><i class="fa fa-home fa-fw"></i></a></li><hr><li><a class="vlts-menu fix-cursor-default" href="https://volantis.js.org/faqs/" id="https:volantisjsorgfaqs"><i class="fa fa-question fa-fw"></i> 常见问题</a></li><li><a class="vlts-menu fix-cursor-default" href="https://volantis.js.org/examples/" id="https:volantisjsorgexamples"><i class="fa fa-rss fa-fw"></i> 示例博客</a></li><li><a class="vlts-menu fix-cursor-default" href="https://volantis.js.org/contributors/" id="https:volantisjsorgcontributors"><i class="fa fa-fan fa-spin fa-fw"></i> 加入社区</a></li><hr><li><a class="vlts-menu fix-cursor-default" href="https://github.com/volantis-x/volantis-docs/" id="https:githubcomvolantis-xvolantis-docs"><i class="fa fa-code-branch fa-fw"></i> 本站源码</a></li><li><a class="vlts-menu fix-cursor-default" href="https://github.com/volantis-x/hexo-theme-volantis/" id="https:githubcomvolantis-xhexo-theme-volantis"><i class="fa fa-code-branch fa-fw"></i> 主题源码</a></li><hr><li><a class="vlts-menu fix-cursor-default" onclick='document.execCommand("print")'><i class="fa fa-print fa-fw"></i> 打印页面</a></li><hr><li><a class="vlts-menu fix-cursor-default toggle-mode-btn"><i class="fas fa-moon fa-fw"></i> Dark</a></li><hr><li class="music name"><p class="nav music-title fix-cursor-default"></p></li><li class="music ctrl"><a class="nav icon-only backward fix-cursor-default" onclick="aplayerBackward()"><i class="fa fa-step-backward fa-fw"></i></a><a class="nav icon-only toggle fix-cursor-default" onclick="aplayerToggle()"><i class="fa fa-play fa-fw"></i></a><a class="nav icon-only forward fix-cursor-default" onclick="aplayerForward()"><i class="fa fa-step-forward fa-fw"></i></a></li><li class="music volume"><a class="nav volume"><div class="aplayer-volume-bar-wrap"><div class="aplayer-volume-bar fix-cursor-pointer"><div class="aplayer-volume"></div><i class="left fa fa-volume-off fa-fw"></i><i class="right fa fa-volume-up fa-fw"></i></div></div></a></li></ul></div><script>function popMenu(e){var t=document.getElementById("rightmenu-wrapper"),n=document.getElementById("rightmenu-content"),l=document.documentElement.clientWidth||document.body.clientWidth,o=document.documentElement.clientHeight||document.body.clientHeight;t.style.left=e.clientX+"px",t.style.top=e.clientY+"px",t.style.display="block",2*e.clientX>l?n.classList.add("left"):n.classList.remove("left"),2*e.clientY>o?n.classList.add("top"):n.classList.remove("top");let c=document.getElementById("hr-text"),d=document.getElementById("hr-src"),y=document.getElementById("hr-href"),s=document.getElementById("menu-copy-src");null!=s&&(e.target.currentSrc?(s.style.display="block",s.addEventListener("click",(function(t){copyString(e.target.currentSrc)}),{once:!0}),d.style.display="block"):(s.style.display="none",d.style.display="none"));let r="";if(e.path)for(i=0;i<e.path.length;i++)null!=e.path[i].href&&e.path[i].href.length>0&&(r=e.path[i].href);let u=document.getElementById("menu-copy-text");u.style.display="none",c.style.display="none",0==r.length&&window.getSelection().toString()&&(u.style.display="block",c.style.display="block");let m=document.getElementById("menu-open-href");null!=m&&(r.length>0?(m.style.display="block",m.addEventListener("click",(function(e){window.open(r)}),{once:!0}),y.style.display="block"):(m.style.display="none",y.style.display="none"));let a=document.getElementById("menu-copy-href");return null!=a&&(r.length>0?(a.style.display="block",a.addEventListener("click",(function(e){copyString(r)}),{once:!0})):a.style.display="none"),volantis.APlayerLoaded&&checkAPlayer(),!1}function hideMenu(){document.getElementById("rightmenu-wrapper").style.display="none"}function copyString(e){const t=document.createElement("input");t.setAttribute("readonly","readonly"),document.body.appendChild(t),t.setAttribute("value",e),t.select(),document.execCommand("copy"),document.body.removeChild(t)}window.document.oncontextmenu=function(e){return!!e.ctrlKey||(!!/Android|webOS|BlackBerry/i.test(navigator.userAgent)||popMenu(e))},document.addEventListener("click",(function(e){document.getElementById("rightmenu-wrapper").style.display="none"})),document.execCommand("click")</script><script>function loadIssuesJS(){0!=$(".md").find(".issues-api").length&&loadScript("https://cdn.jsdelivr.net/npm/hexo-theme-volantis@4.3.1/source/js/issues.min.js")}$((function(){loadIssuesJS()})),volantis.pjax.push(()=>{"undefined"==typeof IssuesAPI&&loadIssuesJS()},"IssuesJS")</script><script defer="defer" src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.1.0/dist/lazyload.min.js"></script><script>window.lazyLoadOptions={elements_selector:".lazyload",threshold:0},window.addEventListener("LazyLoad::Initialized",(function(n){window.lazyLoadInstance=n.detail.instance}),!1),document.addEventListener("DOMContentLoaded",(function(){lazyLoadInstance.update()})),document.addEventListener("pjax:complete",(function(){lazyLoadInstance.update()}))</script><script>window.FPConfig={delay:0,ignoreKeywords:[],maxRPS:5,hoverDelay:25}</script><script defer="defer" src="https://cdn.jsdelivr.net/gh/gijo-varghese/flying-pages@2.1.2/flying-pages.min.js"></script><script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script><script>var clipboard=new ClipboardJS(".btn-copy",{target:function(e){return e.nextElementSibling}});function wait(e,i){window.setTimeout(e,i)}function pjax_initCopyCode(){if($(".highlight .code pre").length+$(".article pre code").length!=0){var e="";e+='<button class="btn-copy" data-clipboard-snippet="">',e+='<i class="fas fa-copy"></i><span>COPY</span>',e+="</button>",$(".highlight .code pre").before(e),$(".article pre code").before(e),clipboard.off("success").on("success",(function(e){let i=$(e.trigger);i.addClass("copied");let a=$(i.find("i"));a.removeClass("fa-copy"),a.addClass("fa-check-circle");let n=$(i.find("span"));n[0].innerText="COPIED",wait((function(){a.removeClass("fa-check-circle"),a.addClass("fa-copy"),n[0].innerText="COPY"}),2e3)})),clipboard.off("error").on("error",(function(e){e.clearSelection();let i=$(e.trigger);i.addClass("copy-failed");let a=$(i.find("i"));a.removeClass("fa-copy"),a.addClass("fa-times-circle");let n=$(i.find("span"));n[0].innerText="COPY FAILED",wait((function(){a.removeClass("fa-times-circle"),a.addClass("fa-copy"),n[0].innerText="COPY"}),2e3)}))}}$((function(){pjax_initCopyCode()})),volantis.pjax.push(pjax_initCopyCode)</script><script type="text/javascript">function pjax_scrollrebeal(){ScrollReveal().reveal(".l_main .reveal",{distance:"32px",duration:"800",interval:"20",scale:"1",easing:"ease-out"})}loadScript("https://cdn.jsdelivr.net/npm/scrollreveal@4.0.6/dist/scrollreveal.min.js"),$((function(){var e=setInterval((function(){"block"==$("#safearea").css("display")&&"undefined"!=typeof ScrollReveal&&(clearInterval(e),pjax_scrollrebeal())}),100)})),volantis.pjax.push(pjax_scrollrebeal)</script><script>let APlayerController=new Object;APlayerController.id="5472211102",APlayerController.volume="0.7",loadCSS("https://cdn.jsdelivr.net/npm/aplayer@1.10/dist/APlayer.min.css",window.volantis.loadcss),loadScript("https://cdn.jsdelivr.net/npm/aplayer@1.10/dist/APlayer.min.js"),window.volantis.APlayerLoaded=0;var checkAPlayer=setInterval((function(){window.APlayer&&"block"==$("#safearea").css("display")&&(clearInterval(checkAPlayer),window.volantis.APlayerLoaded||window.MetingJSElement||(window.volantis.APlayerLoaded=1,loadScript("https://cdn.jsdelivr.net/npm/meting@2.0/dist/Meting.min.js")))}),2500);loadScript("https://cdn.jsdelivr.net/npm/hexo-theme-volantis@4.3.1/source/js/aplayer.min.js")</script><script src="https://cdn.jsdelivr.net/npm/hexo-theme-volantis@4.3.1/source/js/valine.min.js"></script><script>function emoji(i,e,a){return i+"/"+i+"-"+e+"."+a}for(var emojiMaps={},i=1;i<=54;i++)emojiMaps["tieba-"+i]=emoji("tieba",i,"png");for(i=1;i<=101;i++)emojiMaps["qq-"+i]=emoji("qq",i,"gif");for(i=1;i<=116;i++)emojiMaps["aru-"+i]=emoji("aru",i,"gif");for(i=1;i<=125;i++)emojiMaps["twemoji-"+i]=emoji("twemoji",i,"png");for(i=1;i<=4;i++)emojiMaps["weibo-"+i]=emoji("weibo",i,"png");function pjax_valine(){if(!document.querySelectorAll("#valine_container")[0])return;let i=pdata.commentPlaceholder||"快来评论吧~",e=pdata.commentPath;if(0==e.length){e=""||decodeURI(window.location.pathname)}(new Valine).init(Object.assign({path:null,placeholder:"快来评论吧~",appId:"eL9fCmXLl3nAe225XYo1cRxj-MdYXbMMI",appKey:"5uTd5Uu8WJJIej6Efrivsvaa",meta:["nick","mail","link"],requiredFields:["nick","mail"],enableQQ:!0,recordIP:!1,avatar:"robohash",pageSize:10,lang:"zh-cn",highlight:!0,mathJax:!1},{el:"#valine_container",path:e,placeholder:i,emojiCDN:"https://cdn.jsdelivr.net/gh/volantis-x/cdn-emoji/valine/",emojiMaps:emojiMaps}))}$((function(){pjax_valine()})),volantis.pjax.push(pjax_valine)</script><script defer="defer" src="https://cdn.jsdelivr.net/gh/volantis-x/cdn-busuanzi@2.3/js/busuanzi.pure.mini.js" data-pjax></script><script src="https://cdn.jsdelivr.net/npm/hexo-theme-volantis@4.3.1/source/js/app.min.js"></script><script>const SearchServiceimagePath="https://cdn.jsdelivr.net/gh/volantis-x/cdn-volantis@master/img/",ROOT="/".endsWith("/")?"/":"//";function listenSearch(){customSearch=new HexoSearch({imagePath:SearchServiceimagePath})}function setSearchService(){listenSearch()}$(".input.u-search-input").one("focus",(function(){loadScript("https://cdn.jsdelivr.net/gh/volantis-x/cdn-volantis@2.6.4/js/search.js",setSearchService)}))</script><script src="https://cdn.jsdelivr.net/npm/node-waves@0.7.6/dist/waves.min.js"></script><script type="text/javascript">$((function(){Waves.attach(".flat-btn",["waves-button"]),Waves.attach(".float-btn",["waves-button","waves-float"]),Waves.attach(".float-btn-light",["waves-button","waves-float","waves-light"]),Waves.attach(".flat-box",["waves-block"]),Waves.attach(".float-box",["waves-block","waves-float"]),Waves.attach(".waves-image"),Waves.init()}))</script><script src="https://cdn.jsdelivr.net/gh/volantis-x/cdn-volantis@2/js/comment_typing.js"></script><script defer="defer">const LCCounter={app_id:"C2dIVXJ48qC7eHgvQRId6niR-MdYXbMMI",app_key:"1956OGJ4LQhDxheBAO5WhPJn",custom_api_server:"",getRecord:(e,t,r)=>new Promise((function(n,i){e("get","/classes/Counter?where="+encodeURIComponent(JSON.stringify({url:t}))).then(e=>e.json()).then(({results:o,code:s,error:a})=>{if(401===s)throw a;if(o&&o.length>0){var l=o[0];n(l)}else e("post","/classes/Counter",{url:t,title:r,times:0}).then(e=>e.json()).then((e,t)=>{if(t)throw t;n(e)}).catch(e=>{console.error("Failed to create",e),i(e)})}).catch(e=>{console.error("LeanCloud Counter Error:",e),i(e)})})),increment:(e,t)=>new Promise((function(r,n){e("post","/batch",{requests:t}).then(e=>{if((e=e.json()).error)throw e.error;r(e)}).catch(e=>{console.error("Failed to save visitor count",e),n(e)})})),buildIncrement:e=>({method:"PUT",path:"/1.1/classes/Counter/"+e,body:{times:{__op:"Increment",amount:1}}}),validUV(){var e="LeanCloudUVTimestamp",t=localStorage.getItem(e);return!(t&&(new Date).getTime()-parseInt(t)<=864e5)&&(localStorage.setItem(e,(new Date).getTime().toString()),!0)},addCount(e){var t=[],r=[],n=document.querySelector("#lc-sv"),o=this.getRecord(e,"http://aner1001.gitee.io/#lc-sv","Visits").then(e=>{r.push(this.buildIncrement(e.objectId));var t=document.querySelectorAll("#lc-sv #number");t.length>0&&t.forEach((t,r,i)=>{t.innerText=e.times+1,n&&(n.style.display="inline")})});t.push(o);var s=document.querySelector("#lc-uv"),a=this.getRecord(e,"http://aner1001.gitee.io/#lc-uv","Visitors").then(e=>{var t=this.validUV();t&&r.push(this.buildIncrement(e.objectId));var n=document.querySelectorAll("#lc-uv #number");n.length>0&&n.forEach((r,n,i)=>{r.innerText=e.times+(t?1:0),s&&(s.style.display="inline")})});t.push(a);var l=document.querySelectorAll("#lc-pv");for(l.length,i=0;i<l.length;i++){let n=l[i],o=n.getAttribute("data-title");var h="http://aner1001.gitee.io"+n.getAttribute("data-path");if(h){var c=this.getRecord(e,h,o).then(e=>{let t=window.location.pathname;if(t.includes("index.html")&&(t=t.substring(0,t.lastIndexOf("index.html"))),n.getAttribute("data-path")==t&&r.push(this.buildIncrement(e.objectId)),n){var i=n.querySelector("#lc-pv #number");i&&(n.getAttribute("data-path")==t?i.innerText=(e.times||0)+1:i.innerText=e.times||0,n.style.display="inline")}});t.push(c)}}Promise.all(t).then(()=>{r.length>0&&this.increment(e,r)})},fetchData(e){this.addCount((t,r,n)=>fetch(`${e}/1.1${r}`,{method:t,headers:{"X-LC-Id":this.app_id,"X-LC-Key":this.app_key,"Content-Type":"application/json"},body:JSON.stringify(n)}))},refreshCounter(){var e="-MdYXbMMI"!==this.app_id.slice(-9)?this.custom_api_server:`https://${this.app_id.slice(0,8).toLowerCase()}.api.lncldglobal.com`;e?this.fetchData(e):fetch("https://app-router.leancloud.cn/2/route?appId="+this.app_id).then(e=>e.json()).then(({api_server:e})=>{this.fetchData("https://"+e)})}};LCCounter.refreshCounter(),document.addEventListener("pjax:complete",(function(){LCCounter.refreshCounter()}))</script><script>const rootElement=document.documentElement,darkModeStorageKey="user-color-scheme",rootElementDarkModeAttributeName="data-user-color-scheme",setLS=(e,t)=>{localStorage.setItem(e,t)},removeLS=e=>{localStorage.removeItem(e)},getLS=e=>localStorage.getItem(e),getModeFromCSSMediaQuery=()=>window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",resetRootDarkModeAttributeAndLS=()=>{var e;rootElement.removeAttribute("data-user-color-scheme"),e=darkModeStorageKey,localStorage.removeItem(e)},validColorModeKeys={dark:!0,light:!0},applyCustomDarkModeSettings=e=>{const t=e||getLS(darkModeStorageKey);t===getModeFromCSSMediaQuery()?resetRootDarkModeAttributeAndLS():validColorModeKeys[t]?rootElement.setAttribute("data-user-color-scheme",t):resetRootDarkModeAttributeAndLS()},invertDarkModeObj={dark:"light",light:"dark"},toggleCustomDarkMode=()=>{let e=getLS(darkModeStorageKey);if(validColorModeKeys[e])e=invertDarkModeObj[e];else{if(null!==e)return;e=invertDarkModeObj[getModeFromCSSMediaQuery()]}var t,o;return t=darkModeStorageKey,o=e,localStorage.setItem(t,o),e};var btn=$("#wrapper .toggle-mode-btn,#rightmenu-wrapper .toggle-mode-btn");function bindToggleButton(){btn.on("click",e=>{const t=toggleCustomDarkMode();applyCustomDarkModeSettings(t)})}applyCustomDarkModeSettings(),document.addEventListener("DOMContentLoaded",bindToggleButton),volantis.pjax.push(bindToggleButton),volantis.pjax.send(()=>{btn.unbind("click")},"toggle-mode-btn-unbind")</script><script>function listennSidebarTOC(){const e=document.querySelectorAll(".toc li");if(!e.length)return;const t=[...e].map(e=>{const t=e.querySelector(".toc-link"),n=document.getElementById(decodeURI(t.getAttribute("href")).replace("#",""));return t.addEventListener("click",e=>{e.preventDefault(),window.scrollTo({top:n.offsetTop+100,behavior:"smooth"})}),n});!function n(o){o=Math.floor(o+1e4);let r=new IntersectionObserver((r,c)=>{let i=document.documentElement.scrollHeight+100;if(i>o)return c.disconnect(),void n(i);let l=function(e){let n=0,o=e[n];if(o.boundingClientRect.top>0)return n=t.indexOf(o.target),0===n?0:n-1;for(;n<e.length;n++){if(!(e[n].boundingClientRect.top<=0))return t.indexOf(o.target);o=e[n]}return t.indexOf(o.target)}(r);!function(e){if(e.classList.contains("active-current"))return;document.querySelectorAll(".toc .active").forEach(e=>{e.classList.remove("active","active-current")}),e.classList.add("active","active-current");let t=e.parentNode;for(;!t.matches(".toc");)t.matches("li")&&t.classList.add("active"),t=t.parentNode}(e[l])},{rootMargin:o+"px 0px -100% 0px",threshold:0});t.forEach(e=>{e&&r.observe(e)})}(document.documentElement.scrollHeight)}document.addEventListener("DOMContentLoaded",listennSidebarTOC),document.addEventListener("pjax:success",listennSidebarTOC)</script><script>"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").then((function(e){e.onupdatefound=function(){var r=e.installing;r.onstatechange=function(){switch(r.state){case"installed":navigator.serviceWorker.controller?console.log("Updated serviceWorker."):console.log("serviceWorker Sucess!");break;case"redundant":console.log("The installing service worker became redundant.")}}}})).catch((function(e){console.log("Error during service worker registration:",e)}))</script><script src="https://cdn.jsdelivr.net/npm/pjax@0.2.8/pjax.min.js"></script><div class="pjax-animate"><script src="https://cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.js"></script><div id="loading-bar-wrapper"><script>NProgress.configure({parent:"#loading-bar-wrapper",trickleSpeed:100})</script></div><script>window.ShowLoading=function(){NProgress.start()},window.HideLoading=function(){NProgress.done()}</script><script>volantis.pjax.push(window.HideLoading,"HideLoading"),volantis.pjax.send(window.ShowLoading,"ShowLoading"),volantis.pjax.error(window.HideLoading,"HideLoading")</script></div><script>var pjax;document.addEventListener("DOMContentLoaded",(function(){pjax=new Pjax({elements:'a[href]:not([href^="#"]):not([href="javascript:void(0)"]):not([pjax-fancybox])',selectors:["title","#pjax-container","#pjax-header-nav-list"],cacheBust:!1,timeout:5e3})})),document.addEventListener("pjax:send",(function(e){try{var n=window.location.pathname,t=e.triggerElement.href,o=[""];""!=o[0]&&o.forEach(e=>{-1==n.indexOf(e)&&-1==t.indexOf(e)||(window.location.href=t)})}catch(e){}window.subData=null,volantis.$switcher.removeClass("active"),volantis.$header.removeClass("z_search-open"),volantis.$wrapper.removeClass("sub"),volantis.$topBtn.unbind("click"),$(".menu a").unbind("click"),$(window).unbind("resize"),$(window).unbind("scroll"),$(document).unbind("scroll"),$(document).unbind("click"),$("body").unbind("click"),volantis.pjax.method.send.start()})),document.addEventListener("pjax:complete",(function(){$(".nav-main").find(".list-v").not(".menu-phone").removeAttr("style",""),$(".menu-phone.list-v").removeAttr("style",""),$("script[data-pjax], .pjax-reload script").each((function(){$(this).parent().append($(this).remove())}));try{volantis.pjax.method.complete.start()}catch(e){console.log(e)}})),document.addEventListener("pjax:error",(function(e){volantis.pjax.method.error.start(),window.location.href=e.triggerElement.href}))</script></div></body></html>